Automatic push to a Docker private registry
I’ve set up a Docker private registry and I need to push images to this one from a script that is triggered on each successfull build (build is done with Drone from a dedicated build container).
When I issue a ‘docker push’, I first need to authentify to be able to push to the registry.
Is there any setup I could use to keep the credential somewhere and use it within the script ?
2 Solutions collect form web for “Automatic push to a Docker private registry”
The way I envisioned it was to just run the command in my scripts to authenticate to docker before you push the image:
docker login –u <your_username> –p <your_password> <your_docker_registry_fqdn>
I think it is easier to maintain the script should you have a change in the username or password or have multiple users, no need to download another credentials file which you will have to manually generate with the new password or username.
I’ve found that .dockercfg was used to keep the credential and the address of the registry.
Setting this .dockercfg in the $HOME dir fixed the thing.