https://pantsbuild.org/ logo
#development
Title
# development
c

curved-television-6568

09/27/2021, 6:35 AM
Topic: Docker backend At work we mirror quite a number of images from docker hub to private docker registry. Sometimes with some customisations, often as-is. I’m considering whether to have a dedicated target for the purpose of the action of mirroring images between registries, but think it may be possible (and even better) to simply beef up the
docker_image
target to handle this use case easily. (cont. in thread)
The main use case is to allow deploying applications in an air-gapped environment. The mirroring is done in three steps. 1. Docker pull (or Docker build in case of customisations) 2. Docker tag (in case of a pull, as build can tag it in step 1) 3. Docker push When running Docker pull, the image name may not reflect the desired image name to push 1 to 1. There are two main things I want to make this flexible. 1. docker push (publish) and 2. inline dockerfile commands For the plain mirroring, the Dockerfile would simply by a single
FROM
line. It would be much clearer to be able to have the information for the base image, directly in the
docker_image
target.
The biggest win for re-using
docker_image
for mirroring, is when you want customisations, it becomes a regular Docker build, as for plain mirroring it simply is a no-op build with re-tagging and push.
Hmm.. realize this should probably be in a issue instead, that I can refer to from a PR… 😉
f

flat-zoo-31952

09/27/2021, 1:04 PM
i kinda did something like this a long time ago, but i used the repo names as CLI args to a
retag
goal I wrote: https://gist.github.com/jriddy/a1ffb28a41ed3927f0f4a3d68408721c#file-pants_docker_plugin_v3-py-L241-L385
👍 1
c

curved-television-6568

09/27/2021, 1:20 PM
Cool. Will look at for inspiration.