构建私有托管的基础映像[drone.io] [英] Building privately-hosted base image [drone.io]
问题描述
我正在尝试使用Drone和docker插件部署Web服务.由于存在许多依赖性,我的映像大约需要一个小时来构建. 为了加快构建时间,我想在基础映像中放置一些服务的依赖项(不会经常更改),并在部署时在此基础上构建我的实际代码(python flask应用程序)
I am trying to deploy a web service using Drone and the docker plugin. My image takes about an hour to build, due to a number of large dependencies. To speed up build times, I would like to place a number of my service's dependencies (that are not going to change often) in a base image, and just build my actual code (a python flask app) on top of this base when deploying.
我将基本映像托管在私有存储库中,并在Dockerfile中包含以下行:
I am hosting the base image in a private repository, with the following line in my Dockerfile:
FROM: my_private_repo.com/my_base_image:latest
但我不确定如何正确授予Drone访问此存储库.
but I'm not sure how to correctly give Drone access to this repo.
我目前在构建作业中出现以下错误:
I currently have the following error in my build job:
Step 1/11 : FROM:xxx
pull access denied for xxx, repository does not exist or may require 'docker login'
time="2018-01-17T13:13:33Z" level=fatal msg="exit status 1"
有没有办法将docker插件配置为自动登录.
对于上下文,我的YAML类似于:
Step 1/11 : FROM:xxx
pull access denied for xxx, repository does not exist or may require 'docker login'
time="2018-01-17T13:13:33Z" level=fatal msg="exit status 1"
Is there a way for me to configure the docker plugin to login automatically.
For context, my YAML is something like:
push-feature:
image: plugins/docker
secrets: [docker_username, docker_password]
repo: xxx/yyy/zzz
registry: xxx
tags: "feature"
when:
event: push
branch:
exclude: [ dev, master ]
push-feature:
image: plugins/docker
secrets: [docker_username, docker_password]
repo: xxx/yyy/zzz
registry: xxx
tags: "feature"
when:
event: push
branch:
exclude: [ dev, master ]
推荐答案
您可以尝试:
-
在主机上执行
docker login
(如果您在多台服务器上有多个代理,则需要在所有代理主机服务器上执行)
Do a
docker login
on the host (if you have multiple agents on multiple server you need to do in all agent host servers)
使用docker
映像,此仓库需要打开受信任的标志才能挂载主机卷
Use the docker
image this repo needs the trusted flag turned on in order to mount host volumes
pipeline:
build:
image: docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock your-private-registry.com:8080
commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t myorg/myimage .
这篇关于构建私有托管的基础映像[drone.io]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!