搭建本地私有仓库
待补充
阿里云docker仓库
搭建阿里云仓库
创建仓库
设置本地仓库
管理仓库仓库的使用教程
实测有效
联动仓库与git,自动创建image
先在aliyun上创建一个git仓库
新建一个docker仓库并绑定git
选择刚刚创建的git仓库
正常使用git
git clone [email protected]:fat39/registry.git
创建2个文件Dockerfile
和dockercompose.yml
Dokerfile
FROM python:latest
WORKDIR /test
COPY test.py test.py
CMD ["python","./test.py"]
docker-compose.yml
version: '3'
services:
testregistry:
# build:
# context: .
# dockerfile: ./Dockerfile
image: registry.cn-shenzhen.aliyuncs.com/fat39/helloworld2:lastest
test.py
if __name__ == '__main__':
print("hello world")
把以上代码push到git仓库
git push origin master
此时需要在docker仓库设置构建规则
点击立即构建
等待构建完成后,在本地即可使用
登录仓库
直接sudo docker pull registry.cn-shenzhen.aliyuncs.com/fat39/helloworld2:lastest
或者使用docker-compose在刚刚docker-compose.yml的文件夹里输入docker-compose pull
和docker-compose up
.运行docker
此时修改test.py内容,push到git仓库,以触发docker仓库自动生成新的image
if __name__ == '__main__':
print("hello world")
print("66666666666666666")
git push origin master
此时docker仓库后台能看见image创建记录
本次再次pull并运行