我是Docker的新手。谁能帮助我了解两者之间的区别
docker run img_name
和docker pull img_name
吗?
他们工作相同吗?
最佳答案
docker pull
从注册表中提取图像或存储库。docker run
在新容器中运行命令。
它们的工作原理不同,但是,如果将docker run
与尚未拉出的图像一起使用,docker run
将调用docker pull
:
$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:6f744a2005b12a704d2608d8070a494ad1145636eeb74a570c56b94d94ccdbfc
Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e
Deleted: sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:6f744a2005b12a704d2608d8070a494ad1145636eeb74a570c56b94d94ccdbfc
Status: Downloaded newer image for hello-world:latest
…
有关更多信息,请参见
docker help pull
和docker help run
。
关于docker - docker run和docker pull有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56174449/