docker run ubuntu echo hello docker
docker run nginx
^Croot@iZbp1berl2oy3e3vt5476fZ:~# docker run nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
画像を見る
docker images
Dockerを実行する
docker run -p 8080:80 -d nginx
訪問できます:
現在実行中のコンテナを表示する
docker ps
HTMLファイルを作成する
<html>
<h1> Docker is fun 123</h1>
</html>
ページを画像にコピーする
docker cp index.html 173d54b314c1://usr/share/nginx/html
効果を見てください:
魔法の!!!
Dockerコンテナを停止します
docker stop 173d54b314c1
正常にアクセスできない
もう一度やり直してください
docker run -p 8080:80 -d nginx
訪問効果:
そのページを保存します
docker commit -m "fun hlg" a3602cc5370e
この時点で新しい画像が作成されます
今すぐ名前を追加
docker commit -m "fun hlg" a3602cc5370e nginx-fun-hlg
削除コマンド:
docker rmi
現在実行中のビュー
docker ps
やめる:
docker stop
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 13 minutes ago Up 13 minutes 0.0.0.0:8080->80/tcp jovial_kare
root@iZbp1berl2oy3e3vt5476fZ:~# docker stop a3602cc5370e
a3602cc5370e
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@iZbp1berl2oy3e3vt5476fZ:~#
すべてのコンテナを表示
docker ps -a
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 16 minutes ago Exited (0) About a minute ago jovial_kare
173d54b314c1 nginx "/docker-entrypoint.…" 30 minutes ago Exited (0) 19 minutes ago agitated_jennings
9d827f501f82 nginx "/docker-entrypoint.…" 34 minutes ago Exited (0) 33 minutes ago elastic_hugle
857d94349bca nginx "/docker-entrypoint.…" 38 minutes ago Exited (0) 34 minutes ago eloquent_ganguly
fb0eb55c9b8b ubuntu "echo hello docker" 41 minutes ago Exited (0) 41 minutes ago adoring_dirac
72d47427e376 ubuntu "echo hello docker" 42 minutes ago Exited (0) 42 minutes ago serene_wescoff
root@iZbp1berl2oy3e3vt5476fZ:~#
削除
docker rm
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 16 minutes ago Exited (0) About a minute ago jovial_kare
173d54b314c1 nginx "/docker-entrypoint.…" 30 minutes ago Exited (0) 19 minutes ago agitated_jennings
9d827f501f82 nginx "/docker-entrypoint.…" 34 minutes ago Exited (0) 33 minutes ago elastic_hugle
857d94349bca nginx "/docker-entrypoint.…" 38 minutes ago Exited (0) 34 minutes ago eloquent_ganguly
fb0eb55c9b8b ubuntu "echo hello docker" 41 minutes ago Exited (0) 41 minutes ago adoring_dirac
72d47427e376 ubuntu "echo hello docker" 42 minutes ago Exited (0) 42 minutes ago serene_wescoff
root@iZbp1berl2oy3e3vt5476fZ:~# docker rm fb0eb55c9b8b
fb0eb55c9b8b
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 18 minutes ago Exited (0) 3 minutes ago jovial_kare
173d54b314c1 nginx "/docker-entrypoint.…" 33 minutes ago Exited (0) 21 minutes ago agitated_jennings
9d827f501f82 nginx "/docker-entrypoint.…" 37 minutes ago Exited (0) 35 minutes ago elastic_hugle
857d94349bca nginx "/docker-entrypoint.…" 41 minutes ago Exited (0) 37 minutes ago eloquent_ganguly
72d47427e376 ubuntu "echo hello docker" 44 minutes ago Exited (0) 44 minutes ago serene_wescoff
root@iZbp1berl2oy3e3vt5476fZ:~#