将本地docker镜像上传到阿里云个人镜像仓库

将本地docker镜像上传到阿里云个人镜像仓库

1.登录阿里云Docker Registry
$ sudo docker login --username=username 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

用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。
您可以在访问凭证页面修改凭证密码。

2.查看本地镜像:
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 540a289bab6c 3 weeks ago 126MB
hello-world latest fce289e99eb9 10 months ago 1.84kB

3.将镜像推送到Registry
这里以hello-world为例,因为文件比较小,测试方便。
[[email protected] ~]# docker tag hello-world registry.cn-hangzhou.aliyuncs.com/wym123/m001:latest
[[email protected] ~]# docker push registry.cn-hangzhou.aliyuncs.com/wym123/m001:latest
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/wym123/m001]
af0b15c8625b: Pushed
latest: digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a size: 524

然后,我们登录阿里云在仓库中可以查看到刚才推送的镜像,如下图:
将本地docker镜像上传到阿里云个人镜像仓库
说明push成功。