Use docker-compose to pull images from private repository

前端 未结 1 980
悲哀的现实
悲哀的现实 2021-01-03 19:02

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 rep

相关标签:
1条回答
  • 2021-01-03 19:25

    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
    
    0 讨论(0)
提交回复
热议问题