Closed ASchneider-GitHub closed 1 year ago
You want a way to only exit the build script but leave the webserver running? This should happen normally if you do not include the --watch
flag and looks like it is happening here on that last line of your log with
resourcecalculator_build_1 exited with code 0
Meaning that now only the webserver is still running at this point which you should be able to verify with docker ps
. Hitting ctrl-c
after build has exited will kill all the remaining containers which is would just be the webserver.
If what you are hoping to do is have the webserver (and maybe also the build script) run in the background you can employ a couple of different options. One is to modify the run.sh
script's last line to add the detach flag.
# Run docker compose
- docker-compose up
+ docker-compose up -d
this will caused docker-compose to spin up its containers in detached mode and return the terminal to you immediately. This means that you will not have easy access to the output logs for either the webserver or the build script.
The other is to employ a terminal multiplexer like screen
or tmux
and run run.sh
in one of their sessions, then exit out of their sessions back to your original ssh prompt.
If I am not understanding your usecase can you explain what you are hoping to accomplish at a higher level?
If what you are hoping to do is have the webserver (and maybe also the build script) run in the background you can employ a couple of different options. One is to modify the
run.sh
script's last line to add the detach flag.# Run docker compose - docker-compose up + docker-compose up -d
this will caused docker-compose to spin up its containers in detached mode and return the terminal to you immediately. This means that you will not have easy access to the output logs for either the webserver or the build script. I am not understanding your usecase can you explain what you are hoping to accomplish at a higher level?
This might actually be what I'm looking for. I didn't do a good job of explaining it, which is my bad. I have an Ubuntu server running Docker with multiple containers that I manage through the CLI. I cloned the ResourceCalculator
repo to Docker host, cd
d into the grabbed folder, and ran sudo ./run.sh
to launch the resource. The script goes through what I assume is the normal deployment process with Docker Compose, and then returns the message
resourcecalculator_build_1 exited with code 0
Instead of then returning me to the CLI so I can continue doing work on other containers, it "locks" you into the script. If you back out with ctrl-c
, the script terminates but the WebUI container is brought down as well. I was looking for a way to back out of the script without shutting down the container. So far the only solution I was found was to use an SSH session on Windows to start the container, and then closing the actual WSL application to cut the connection without terminating the script. After that I can SSH back in and the container will be left running. Not the cleanest approach, so I'll give your method a shot with the detached mode
Glad to have been able to help. If this solved your question you may close this issue.
I cloned to repo to an Ubuntu 20.04 host with Docker and docker-compose installed, and everything gets set up correctly when running
./run
asroot
. After running the script I get the outputbut then the script doesn't terminate. Instead it seemingly hangs until it's manually stopped with
ctrl-c
. When terminating the script that way, the Docker contains are both stopped and the web instance goes down. The only way to get out of the script without stopping it is to close out of my SSH session entirely and log back in.Is there a way to terminate the script without closing out the containers?