搭建docker镜像,并将开发的数据打包成镜像,推送到docker的私有仓库,方便开发。
搭建的步骤如下:
1、拉取registry镜像
docker
2、生成registry容器,开放5000端口
docker
docker run -d -p 5000:5000 -v /data/registry:/tmp/registry registry
docker ps
docker exec
3、客户端设置daemon.json文件 (指定私有仓库位置)
vim
101.37.171.235:5000 为自己机器的外网IP和端口号
“https://docker.mirrors.ustc.edu.cn”, “https://hub-mirror.c.163.com” 为可用的外网docker镜像
{"insecure-registries":["101.37.171.235:5000"],
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn", "https://hub-mirror.c.163.com"]
}
4、创建本地的镜像标签
docker
docker tag httpd:latest 101.37.171.235:5000/httpd
5、上传镜像并测试
docker push 101.37.171.235:5000/httpd
curl
6、下载镜像测试
docker pull 101.37.171.235:5000/httpd
附注、设置docker的registry 开启自启动
docker update --restart=always 1778d51b6342