utkarsh31
utkarsh31

Reputation: 1549

Use docker-compose to pull images from private repository

I'm using docker-compose command to run multiple containers. The problem is my docker-compose has to pull some images from the public repository and some from a private repository. What I'm planning to do is push all required images to the private repository but how can I make docker-compose pull the images from the private repository.

In short -> How to point to a private repository when the images are only available there

Upvotes: 48

Views: 54780

Answers (1)

6be709c0
6be709c0

Reputation: 8441

Use docker login command. (Official doc)
Enter your credentials, and then you can pull private image, only if you have an access.

If you want to login to a self-hosted registry you can specify this by adding the server name.

docker login localhost:8080

Thanks to @herm's comment, if you want to use swarm, use : --with-registry-auth option. Personnaly, I use this command :

docker stack deploy --with-registry-auth --compose-file dev.compose.yml myProjectName

Upvotes: 45

Related Questions