官方版解释
docker tag local-image:tagname new-repo:tagname
docker push new-repo:tagname
我自己实践:
假定已经拥有Docker ID。
首先登录自己的ID
docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: remtor
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
查看容器
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8d79e84753dd ubuntu:latest "/bin/bash" About an hour ago Exited (130) 20 minutes ago ubuntu-flask
对需要push的容器打tag
docker commit -m "flask and nginx base ubuntu" 8d79e84753dd remtor/flask:1.0
查看镜像
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
remtor/flask 1.0 86666c1e7c87 6 seconds ago 219MB
然后push
docker push remtor/flask:1.0
最后去检验一下。

还算成功!

本文介绍将Docker容器push到Docker Hub的实践过程。假定已拥有Docker ID,先登录ID,接着查看容器,对需push的容器打tag并查看镜像,然后进行push操作,最后检验,实践较为成功。
1万+

被折叠的 条评论
为什么被折叠?



