上下文:我使用repo2docker
构建包含实验的图像,然后将它们推送到私有注册表。
我用docker-compose
将整个管道(克隆实验代码,构建图像,推动它)固定在底。
这是我试过的:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y python3-pip python3-dev git apt-transport-https ca-certificates curl software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
RUN apt-get update && apt-get install docker-ce --yes
RUN service docker start
# more setup
ENTRYPOINT rqworker -c settings image_build_queue
然后我将工作传递给rqworker(rqworker部分工作正常)。
但docker
并没有从我的容器开始。因此,我无法登录到注册表,无法构建图像。
(注意我需要运行docker
,但我不需要运行容器。)
解决方案是共享主机的Docker套接字,因此构建实际上发生在主机上。