Search code examples
dockerdocker-composedockerfiledocker-registrydocker-repository

How to pull docker image from private docker repository in docker-compose.yml?


How can I add the docker hub credentials in docker-compose.yml and pull the private image?

I want to pull 2 images from 2 different private repositories?


Solution

  • To push to or pull from private registry, you just need to add the registry’s location to the repository name. It will look like my.registry.address:port/repositoryname

    On a fresh build it looks as follows

    docker push localhost.localdomain:5000/ubuntu
    Username (): user
    Password:
    Email (): [email protected]
    

    Then you can use docker login multiple times before running docker-compose, one for each registry, and they will stack.