docker-compose build in background?

Viewed 1055

I have to setup a new system where I copied 50 Apps which should be built with docker-compose build. This compose file is just there to build the images, the images/containers get spin up from other file. So my questions is:

docker-compose build -d does not work unfortunately.

https://docs.docker.com/compose/reference/up/#:~:text=The%20docker%2Dcompose%20up%20command,background%20and%20leaves%20them%20running.

Is there any way to run that build progress in detached mode or use a workaround? This process might take like 20 hours and if I am idle for long enough I will get disconnected and the build process stops

1 Answers

A workaround could be to make use of:

nohup docker-compose build &

& will allow the command to run in the background.

Prefixing nohup will prevent the command from being aborted when you exit the shell. It won't accept any input, but will write all output to nohup.out and places it in your current directory.

If you do not wish to receive any output, you can write the output to /dev/null:

nohup docker-compose build >& /dev/null &
Related