Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to demonize one image of a docker-compose composition?

I have a docker-compose consisting of three images, project_a, project_b, project_c.

I can run:

docker-compose up -d

which will start all the images in the background not printing their output to the current shell.

I can also just start a specific image by:

docker-compose up project_b

Yet this will print the log of project_b to the shell.

Hence, I thought I can just run:

docker-compose up project_b -d

Yet this will throw:

ERROR: No such service -d

How to just start one container in a docker-compose stack in the background?

like image 488
k0pernikus Avatar asked Dec 01 '25 06:12

k0pernikus


1 Answers

Order does matter, as:

 docker-compose -d project_b

will run fine. If the option flag is at the end, it will be read as an image name.

like image 170
k0pernikus Avatar answered Dec 05 '25 06:12

k0pernikus