登录到阿里云容器镜像服务
https://cr.console.aliyun.com/cn-hangzhou/instance/repositories
阿里云操作
- 1、创建命名空间tom_namespace1
2、创建镜像仓库tom_registry
docker环境操作
- 官网介绍步骤
$ docker login --username=ali_耕耘 registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry:[镜像版本号]
- 实操
1、登录到阿里云仓库
$ docker login --username=ali_耕耘 registry.cn-hangzhou.aliyuncs.com
2、镜像打tag
[root@localhost first-docker]# docker tag first-image registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry:first-image-v1.0
3、推送镜像
[root@localhost first-docker]# docker push registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry:first-image-v1.0
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry]
4、拉取镜像
docker pull registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry:first-image-v1.0
5、运行镜像
docker run -d --name hello03 -p 6668:8080 registry.cn-hangzhou.aliyuncs.com/tom_namespace1/tom_registry:first-image-v1.0
6、运行结果;
[root@localhost first-docker]# curl http://localhost:6668/dockerfile
hello docker
第3部完成后远程仓库可以查看到镜像