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?
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?
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 (): user@pass.com
Then you can use docker login multiple times before running docker-compose, one for each registry, and they will stack.
You need to use docker login before invoking docker-compose:
https://docs.docker.com/engine/reference/commandline/login/
You would do something like this
services:
s1:
image: repo.foo.com/s1
s2:
image: repo.bar.com/s2
You would login once and Docker would remember your credentials:
docker login -u user1 -p pass1 https://repo.foo.com
docker login -u user2 -p pass2 https://repo.bar.com
and then you would run docker-compose as many times as you need.