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.

  • How to Install Hadoop slaves in docker make a master node on local computer to handle these slave nodes?
  • Dockerfile - removing a file in one RUN command, it is still present in the next RUN command
  • Pbs with python tempfile.mkdtemp in gitlab-ci docker
  • /home/web/.gem/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:152:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
  • Configure CodeSniffer on PhpStorm using Docker
  • docker start <container ID> doesn't do anything
  • Is there any setup I could use to keep the credential somewhere and use it within the script ?

  • Docker Nginx + Node: address already in use
  • Docker networking: how to show connected containers names
  • PHP-Apache in Docker with only one request in the same time
  • How to bootstrap a docker container?
  • kube-dns not working on kubernetes arm
  • Docker Ubuntu 16 on a Ubuntu 14 machine : no Internet connection
  • 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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.