We’re trying to determine if it’s possible to use either the drone-ecr or drone-docker plugin to pull from an ECR registry to use that image for non-publishing purposes.
The documentation as well as other questions on this site seem to refer exclusively to building and publis use cases.
Is it possible to pull from an ECR registry with drone?
If so, how is this achieved and how does one avoid ECR’s 12h authentication expiry time? Are there any examples of configuring and pulling from ECR with Drone?
Alternatively, you could download newer images on the host machine at the start of your pipeline so that they exist in the local docker cache. It could look something like this (below) and could even be encapsulated into a plugin.
The negative to the above approach is that you have to run your builds in trusted mode in order to expose the host machine docker socket, which has security implications.
Another solution I just implemented is to use the drone-go libraries to create a aws lambda which updates the credentials for our ecr registry every 6 hours (tokens last 12 hours)
Since I’m running drone on EC2, I’ve found it convenient to add a cron job to my hosts to periodically docker login using the instance profile already available to the host machine. I added to my cloud-init script:
There is a not-yet-documented feature in 1.0.0-rc.1 that you can use to instruct your agents (or your server if you are running agentless, single-server) to load the .docker/config.json file from the host machine.
First you need to mount the config file into your agent container:
Is this up-to-date? I’m struggling to find documentation anywhere else for how to run pipeline steps with images from a private docker registry in 1.0.0-rc.1. Are there plans to move to a simpler configuration for this like what was available in 8.0?