Compose: Send foreground process to background

Created on 5 Oct 2015  路  8Comments  路  Source: docker/compose

Is it possible to send a foreground process (started without the -d flag) to run as a background daemon later on?

areup kinquestion

Most helpful comment

ctrl-zworks for me. After running docker-compose up and observing every thing is running ok, ctrl-z will dettach me from the process, leaving containers still running. I am with docker-compose version 1.15.0.

All 8 comments

-d isn't actually "background" it's "detached". The docker-compose process stops. There isn't any way to detach the the "attached" mode without shutting down containers. I would recommend just using detached and docker-compose logs

Thank you for the clarification @dnephin.

You _can_ actually detach from a docker run -it with Ctrl-p Ctrl-q. We should arguably support that with docker-compose run.

It would be a useful feature. On dev environment I sometimes forget to add the -d flag. When there are multiple linked containers with scaling, it takes some time to stop all the containers and restart with the -d flag.

+1 for supporting it from docker-compose up and docker-compose run

Otherwise, is it possible to set detached mode to be the default mode? So if I run docker-compose up it'll run in detached mode by default?

ctrl-zworks for me. After running docker-compose up and observing every thing is running ok, ctrl-z will dettach me from the process, leaving containers still running. I am with docker-compose version 1.15.0.

nohup worked for me across several versions :)

Was this page helpful?
0 / 5 - 0 ratings