-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Desktop CLI Commands
foolmacky edited this page Nov 14, 2022
·
8 revisions
//imageのそのままの取得
docker pull centos:centos7
//imageの確認
docker images
//imageの起動(コンテナ名付き)
docker run -it -d --name centos7 centos:centos7
//docker desktopのUIからでも起動できるが、portのbind, networkの設定などの細かい設定はコマンドでしかできない
docker run -it -d --name centos7 -p 80:8080 -h foolmacky.centos7.com centos:centos7
//ホスト側8080portとコンテナ80portが直結される
//コンテナのhostnameを設定したので、ホストの/etc/hostsファイルに設定することができる
0.0.0.0 foolmacky.centos7.com
//containerにログイン
docker exec -it centos7 /bin/sh
- https://hub.docker.com/_/centos
- コンテナを作成するときに予め設定するようだが、自分が試した感じでは実行できなかった。。。