I want to script docker push
commands. Such a command typicaly requires credentials. The usual way here is to call docker login
to interactively enter the credentials for a docker registry. This is not the way to go for scripted usecases.
docker login
writes the entered information into a ~/.dockercfg. If you know how to encode the data it would be possible to create this file on-the-fly to prepare calls to docker push
. So far, so good.
But I’m living in multi-process environment (on jenkins) where multiple actions are executed in parallel. As far as I understand the reference documentation the usage of the config file in the user’s home directory is hard coded. This is not appropriate for a multi-process environment acting in parallel with different registries.
I was looking for some command line option like --dockercfg=/path/to/dockercfg
, or at least some environment variable to feed the commands with configuration options like the registry credentials. But I couldn’t find something like this.
Are there any possibilities to script push commands including credential specification besides the strange way of switching the ‘HOME’ of every usage of docker push
to a different temporary folder?