娜尼的妮妮

导航

Docker 训练之 run hello-world

 1 docker run 

docker run hello-world
docker run -rm  //rm 参数表示退出容器之后,这个容器就被删除了

  

 

 2 docker images

docker images //列出当前环境中的docker image 列表

  

      

3 docker ps

 此处执行docker ps 看到并没有running 的container 被列出,是因为hello-world这个container在运行之后即刻退出了

 

     

4 使用docker inspect <imagename>来查看指定docker image的信息

    

docker inspect d1165
[ { "Id": "sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726", "RepoTags": [ "hello-world:latest" ], "RepoDigests": [ "hello-world@sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e" ], "Parent": "", "Comment": "", "Created": "2021-03-05T23:25:25.230064203Z", "Container": "f5a78ef54769bb8490754e9e063a89f90cc8eee6a6c5a0a72655826e99df116e", "ContainerConfig": { "Hostname": "f5a78ef54769", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/sh", "-c", "#(nop) ", "CMD [\"/hello\"]" ], "Image": "sha256:77fe0a37fa6ce641a004815f2761a9042618557d253f312cd3da61780e372c8f", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": {} }, "DockerVersion": "19.03.12", "Author": "", "Config": { "Hostname": "", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/hello" ], "Image": "sha256:77fe0a37fa6ce641a004815f2761a9042618557d253f312cd3da61780e372c8f", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": null }, "Architecture": "amd64", "Os": "linux", "Size": 13336, "VirtualSize": 13336, "GraphDriver": { "Data": { "MergedDir": "/var/lib/docker/overlay2/2cb70d969b4b2e9c25ab3af3676d701c0483f556ea340a6424ae6f3dc6fbae08/merged", "UpperDir": "/var/lib/docker/overlay2/2cb70d969b4b2e9c25ab3af3676d701c0483f556ea340a6424ae6f3dc6fbae08/diff", "WorkDir": "/var/lib/docker/overlay2/2cb70d969b4b2e9c25ab3af3676d701c0483f556ea340a6424ae6f3dc6fbae08/work" }, "Name": "overlay2" }, "RootFS": { "Type": "layers", "Layers": [ "sha256:f22b99068db93900abe17f7f5e09ec775c2826ecfe9db961fea68293744144bd" ] }, "Metadata": { "LastTagTime": "0001-01-01T00:00:00Z" } }

  

 

posted on 2021-07-29 10:24  娜尼的妮妮  阅读(2362)  评论(0编辑  收藏  举报