root@photon-machine [ ~ ]# docker search centos | more NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 3050 [OK]
root@photon-machine [ ~ ]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE root@photon-machine [ ~ ]#
いまはイメージがなにもない状態です。
root@photon-machine [ ~ ]# docker pull centos Using default tag: latest latest: Pulling from library/centos Digest: sha256:c577af3197aacedf79c5a204cd7f493c8e07ffbce7f88f7600bf19c688c38799 Status: Downloaded newer image for centos:latest
root@photon-machine [ ~ ]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos latest 67591570dd29 6 weeks ago 191.8 MB root@photon-machine [ ~ ]#
落ちてきているのが確認出来ました。
root@photon-machine [ ~ ]# docker rmi centos:latest Untagged: centos:latest Untagged: centos@sha256:c577af3197aacedf79c5a204cd7f493c8e07ffbce7f88f7600bf19c688c38799
root@photon-machine [ ~ ]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE root@photon-machine [ ~ ]#
消えました。
root@photon-machine [ ~ ]# docker pull centos root@photon-machine [ ~ ]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos latest 67591570dd29 6 weeks ago 191.8 MB root@photon-machine [ ~ ]# docker run centos echo "hello world" hello world root@photon-machine [ ~ ]#
イメージからコンテナが作成され、実行されました。そして終了しました。
root@photon-machine [ ~ ]# docker ps -a -n=1 ←-a: 終了したモノも表示、 -n=xx 直近 xxコを表示 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 60d7c5d76f05 centos "echo 'hello world'" About a minute ago Exited (0) About a minute ago berserk_wright root@photon-machine [ ~ ]#
コンテナが作成されたのが分かります。 docker rm 60d7c5d76f05 で削除可能です。
この記事は
現在のアクセス:2197