如何使用<none>标签运行Docker镜像

11
我有一个带有<none>标签的Docker镜像。enter image description here 我想要运行TAG为<none>的hello-world镜像。我该怎么做?
4个回答

19
为了运行一个悬挂镜像,您首先需要为该镜像打上标签。您可以使用图像ID来完成此操作。 例如:
docker tag [IMAGE_ID] [REPOSITORY]:[TAG]

现在,您可以使用刚刚定义的标签运行该图像。


6
您可以使用镜像的ID来运行特定镜像的容器,例如:
docker run -it efb6339f1b3e /bin/bash

如果想要给镜像打标签,可以使用 docker build 命令中的 -t 选项,例如:

docker build -t codinghaus/hello-world:1.0.0

0
docker tag <image-name> <image-name>[:tag]

例子:

docker tag hello_world hello_world[:2]

0
我成功地以这种方式运行了它,图像的标签是'none' enter image description here 在MacOS上的命令: docker run -it --entrypoint=/bin/bash --env-file ~/docker/env.list -u root a480ebfb5d6d9ef62eef279512f6cadb57717efaa8b05afe301c52ed27ff9ef0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接