注册阿里云账号
- 开通容器镜像服务
- 创建凭证固定密码
- 创建命名空间
- 创建容器镜像
提交镜像
[root@centos72 ~]# 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
[root@centos72 ~]#
- 登陆自己的账号,提示
Login Succeeded
即成功,可以提交镜像了
[root@centos72 ~]# docker login --username=xxxxx@gmail.com registry.cn-guangzhou.aliyuncs.com
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
# 提交本地的 leoiceo/centos7-tomcat
[root@centos72 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
leoiceo/centos7-tomcat latest 625f270f4f40 2 days ago 805MB
# 打个标签
docker tag 625f270f4f40 registry.cn-guangzhou.aliyuncs.com/leoiceo/tomcat:10.0.0.2
# 生成一个新的image
[root@centos72 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
leoiceo/centos7-tomcat latest 625f270f4f40 2 days ago 805MB
registry.cn-guangzhou.aliyuncs.com/leoiceo/tomcat 10.0.0.2 625f270f4f40 2 days ago 805MB
# 推送镜像
[root@centos72 ~]# docker push registry.cn-guangzhou.aliyuncs.com/leoiceo/tomcat:10.0.0.2
The push refers to repository [registry.cn-guangzhou.aliyuncs.com/leoiceo/tomcat]
87f158fe0ab1: Pushed
83e5b8cd7e47: Pushed
37b05c8f96a7: Pushed
14036f656c93: Pushed
174f56854903: Mounted from leoiceo/mycentos
10.0.0.2: digest: sha256:09072a3e65e86c48fd7180af006b45b6dedc52d61e061456b20aa77c68522254 size: 1373