我正在学习本教程Getting Started with Docker for the Node.js Developer,一切顺利,直到我完成教程结束,其中一个是执行这些命令......
$ docker tag node-express your_docker_hub_username/node-express
$ docker rmi node-express
$ docker push your_docker_hub_username/node-express
所以对于我的系统,我做到了......
$ sudo docker ps -a | grep centos
1c912e61636d node-express-centos:latest "/bin/bash" 31 minutes ago Exited (130) 28 minutes ago gloomy_mestorf
$ sudo docker tag node-express-centos redcricket/node-express-centos
FATA[0000] Error response from daemon: could not find image: no such id: node-express-centos
$ sudo docker tag node-express-centos:latest redcricket/node-express-centos
FATA[0000] Error response from daemon: could not find image: no such id: node-express-centos:latest
...正如您所见,我收到了这些FATA错误。我在这做错了什么?
答案 0 :(得分:1)
运行容器时,需要对其进行命名,以便能够按名称引用它。如果没有,您将必须使用容器ID引用它。
要为您的容器命名,您可以
$ docker run - - name node-express-centos node-express-centos:latest
然后,您可以使用上面使用的相同命令进行标记。