目录
三.在访问凭证中设置固定密码用于登录,登录时用户名是使用你注册阿里云的账号名称,密码使用设置的固定密码
一.登录进入阿里云网站,点击个人实例进行创建
二.创建仓库,填写相关信息
选择公共,私有在拉取镜像时需要登录
选择本地仓库
创建完成
三.在访问凭证中设置固定密码用于登录,登录时用户名是使用你注册阿里云的账号名称,密码使用设置的固定密码
[root@localhost ~]# docker login --username=aliyun783xxxxxxx registry.cn-hangzhou.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
四.为镜像打标签并推送到仓库
[root@localhost ~]# docker tag mysql:5.6 registry.cn-hangzhou.aliyuncs.com/su03/mycontainer:mysql_5.6 #这个地址在仓库信息页面直接复制
[root@localhost ~]# docker push registry.cn-hangzhou.aliyuncs.com/su03/mycontainer:mysql_5.6
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/su03/mycontainer]
7137327a7221: Pushed
49a1ca1cd2b8: Pushed
7c5a5c1986b1: Pushed
eba393347f89: Pushed
2612088e90f6: Pushed
e3dce1c82d4e: Pushed
7ea96a4e341b: Pushed
4085e588967d: Pushed
d414fdead0b9: Pushed
2e1029557391: Pushed
2b83e5699838: Pushed
mysql_5.6: digest: sha256:897086d07d1efa876224b147397ea8d3147e61dd84dce963aace1d5e9dc2802d size: 2621
五.拉取镜像验证
[root@localhost ~]# docker pull registry.cn-hangzhou.aliyuncs.com/su03/mycontainer:mysql_5.6
mysql_5.6: Pulling from su03/mycontainer
Digest: sha256:897086d07d1efa876224b147397ea8d3147e61dd84dce963aace1d5e9dc2802d
Status: Image is up to date for registry.cn-hangzhou.aliyuncs.com/su03/mycontainer:mysql_5.6
registry.cn-hangzhou.aliyuncs.com/su03/mycontainer:mysql_5.6
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.6 dd3b2a5dcb48 20 months ago 303MB
registry.cn-hangzhou.aliyuncs.com/su03/mycontainer mysql_5.6 dd3b2a5dcb48 20 months ago 303MB
owncloud latest 327bd201c5fb 4 years ago 618MB
[root@localhost ~]# docker run -it --name alimysql registry.cn-hangzhou.aliyuncs.com/su03/mycontainer:mysql_5.6 ls /
bin boot dev docker-entrypoint-initdb.d entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var