Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing docker login in docker-compose file

I am relatively new to docker and have a docker-compose file where I want to access a private repository.

Since the docker-compose file will also run on other computers, I would like to integrate the docker login command into the docker-compose file. So that docker-compose up is executed and then as with docker login the user data must be entered.

Is this possible at all?

Unfortunately in my search so far I have not found a way to integrate the command.

Thanks for your help.

like image 455
mafgan Avatar asked Jun 23 '26 09:06

mafgan


1 Answers

No; there's no way to specify repository credentials in a docker-compose.yml file. (And you definitely would not want to commit them to source control or distribute them in a plain-text file even if it were possible.) You need to manually run docker login on each system.

like image 166
David Maze Avatar answered Jun 25 '26 12:06

David Maze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!