发布到DockerHub上
1.首先需要注册dockerhub的账号
2.确定这个账号可以登录
3.在我们的服务器提交自己的镜像
[root@VM-0-14-centos ~]# docker login --help
Usage: docker login [OPTIONS] [SERVER]
Log in to a Docker registry.
If no server is specified, the default is defined by the daemon.
Options:
-p, --password string Password
--password-stdin Take the password
from stdin
-u, --username string Username
4.登录完毕后方可提交镜像,docker push
[root@VM-0-14-centos ~]# docker login -u chenyu199702
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
# 提交被拒绝
root@VM-0-14-centos ~]# docker push mycentos:1.0
The push refers to repository [docker.io/library/mycentos]
99b9cbc97f40: Preparing
abb030d27363: Preparing
2653d992f4ef: Preparing
denied: requested access to the resource is denied
[root@VM-0-14-centos ~]#
# 镜像命名和版本信息未注意
docker [用户名]/[镜像名]:版本号
#先修改标签
[root@VM-0-14-centos dockerfile]# docker tag 7a63efdb8e59 chenyu199702/mycentos:3.0
# 再次提交,由于是外网上传比较慢
[root@VM-0-14-centos dockerfile]# docker push chenyu199702/mycentos:3.0
99b9cbc97f40: Pushing 2.692MB/29.46MB
abb030d27363: Pushing 549.9kB/68.07MB
2653d992f4ef: Pushing 4.914MB/209.3MB
发布到云镜像服务
1.登录到云服务器
2.找到容器服务
3.创建命名空间
4.创建容器镜像
注释:参考不容服务器运行商的文档