docker - 从容器内部构建和推送 docker 映像
问题描述
上下文:我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 套接字,因此构建实际上发生在主机上。
推荐阅读
- python-3.x - 如何使用超时停止阻塞函数 subscribe.simple
- rabbitmq - 1个请求交换,1个回复交换,N个响应
- azure-cli - “az ad sp credential list”命令输出“enddate”到标准日期格式转换
- reactjs - React-Monaco-Editor:找不到由 monaco-editor-webpack-plugin 生成的工作人员
- python-3.x - lightgbm是真的能捕捉到线性趋势吗
- lua - 具有 nil 值的 Lua 长度运算符 (#)
- git - 当我尝试在 VS2019 中应用某个 git stash 时,我收到一条错误消息,提示存在未提交的更改(没有)并且只应用了一个文件
- jquery - 带有两个嵌套弹性框的动态网格网格不起作用?
- react-native - 通过单击 React Native 中的按钮在 TabNavigator 上的屏幕之间导航
- firebase - 对 Firebase 模拟器被忽略的功能进行故障排除