Hello!
I’m very new to Docker so please forgive me if I’m overlooking something simple here. My issue is, I can start my container using the command line and it will continue to run until I stop it with no problems. However, when I start my container using Docker Desktop, it immediately exits with a code 0 and there are no errors listed or anything in the log to indicate why this happens. After searching for answers, I found that this is most likely due to the lack of a foreground process running which would, in turn, keep the container running. However, I’m not sure what I need to do to set that up.
EDIT: After posting this, I ran the Docker stop command, and then after starting the container again a few minutes later (from the command line), it is now stopping immediately after stopping just as it does in Docker Desktop. I removed the container and then rebuilt and started it again (via command line) and now it’s continuing to run. I’m a bit baffled as to what happened here. Again, there is nothing in the log to show why this occurred.
Here is some more information about what I’m working with and what I’ve done. I’m on a Windows 11 host and pulled the Docker image zaproxy/zap-stable to run using this Docker compose file:
services:
zap:
image: Package zaproxy · GitHub
user: zap
volumes:
- C:/Users/adria/Docker Projects/zap/zap_data:/zap/wrk/:rw
ports:
- “8080:8080”
- “8090:8090”
command: zap-webswing.sh
The container image is for OWASP ZAP which is an application that is accessed from the host’s web browser (Firefox in my case) by navigating to the localhost address and port. It depends on webswing to accomplish this.
If someone could please help me understand how to set an appropriate process to run in the foreground so that I can use Docker Desktop to start the container (and keep it running), I would really appreciate it! Or maybe I’m wrong entirely about the foreground process, in which case, if someone could point me in the right the direction I would appreciate that as well! If any further info is needed from me please let me know.