redhat quay 可以类似docker hub 那样进行镜像的构建,以下是一个学习,但是在测试中发现流程是可以通的,但是
quay 在对于dockerfile 内容处理上有bug,造成builder 获取到的内容为空,无法进行镜像构建
环境准备
- dockerc-compose
version: "3"
services:
postgres:
image: postgres:10
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
redis:
image: redis
ports:
- "6379:6379"
privileged: true
quay-config:
image: dalongrong/quay:v3.1.2
command: config
env_file:
- .env
privileged: true
ports:
- "8443:8443"
quay-deploy:
image: dalongrong/quay:v3.1.2
env_file:
- .env
privileged: true
volumes:
- "./quay/config:/conf/stack:Z"
- "./quay/storage:/datastorage:Z"
ports:
- "443:8443"
- "8080:8080"
quay-builder:
image: dalongrong/quay-builder
environment:
- "SERVER=ws://quay-deploy:8787"
volumes:
- "/var/run/docker.sock:/mnt/docker.sock"
- 配置部分
可以参考官方文档,或者https://www.cnblogs.com/rongfengliang/p/11850908.html - 简单说明
运行需要配置host 文件
127.0.0.1 quay-deploy
quay-builder 说明
quay-builder 是包含了websocket 服务的通信以及与BuildManager获取构建内容,运行需要docker engine
运行的时候我们可以通过环境变量配置server
运行使用
- 添加基于dockerfile 的内容构建
- 选择dockerfile
- 构建效果
- 失败原因:
builder 日志
quay-builder_1 | time="2019-11-13T12:54:07Z" level=info msg="decoded build args: rpc.BuildArgs{BuildPackage:"http://quay-deploy:8080/userfiles/f873ae85-f9e2-4d10-a663-08921bae216d", Context:"/", DockerfilePath:"Dockerfile", Repository:"rong/dockerfile", Registry:"quay-deploy:8080", PullToken:"7MPM2WSQ1GXSMA3BNLNEF2M2MW7J205FQTP9N8IMQGB5UG57WSBW6YFWA6CNLH7U", PushToken:"7MPM2WSQ1GXSMA3BNLNEF2M2MW7J205FQTP9N8IMQGB5UG57WSBW6YFWA6CNLH7U", TagNames:[]string{"latest"}, Git:(*rpc.BuildArgsGit)(nil), BaseImage:rpc.BuildArgsBaseImage{Username:"", Password:""}}"
quay-builder_1 | time="2019-11-13T12:54:07Z" level=info msg="connecting to docker host: unix:///var/run/docker.sock"
从以上我们可以看出需要请求dockerfile 的内容,但是server 返回的内容为空
实际文件目录的内容
说明
以上就是集成builder 进行docker 镜像构建,但是有bug,流程没有问题,同时在集成gitlab等的时候无法,获取组下边的项目(可能是gitlab 版本的问题?)
参考资料
https://github.com/quay/quay
https://github.com/quay/quay-builder
https://access.redhat.com/documentation/en-us/red_hat_quay/3/html/use_red_hat_quay/build-support
https://hub.docker.com/repository/docker/dalongrong/quay-builder
https://hub.docker.com/repository/docker/dalongrong/quay