Troubleshooting Web Applications Deployed with CapRover in Docker Containers

Jump into the terminal of a CapRover app named testapp. Use Ctrl + P, then Ctrl + Q to exit that terminal without killing the container.

docker exec -it $(docker ps --filter name=srv-captain--testapp -q) bash

Logs of the deployed application (–follow keeps retrieving the latest events):

docker service logs srv-captain--my-app --since 60m --follow

CapRover logs:

docker service logs captain-captain --since 60m --follow

Logs for Docker itself (if your application keeps getting respawned in new containers, the answer may be in here):

systemctl status -l docker

See nginx records:

docker service ps captain-nginx --no-trunc

Restart CapRover:

docker service update captain-captain --force

Restart Docker

sudo systemctl daemon-reload
sudo systemctl restart docker

If your app is running in local but the container is repeatedly crashing on the server, jt may be because of a missing dependency only used by the server. For example, if you are testing in local with flask run while the server uses gunicorn, your requirements.txt may be missing some dependencies, as my requirements.txt was missing the following once. I ended up installing these in the local virtual environment as a workaround, just so they are included in each new copy of the requirements.txt after a new pip freeze.

gevent==22.10.1
greenlet==1.1.3.post0
gunicorn==20.1.0

If you are testing locally on a Windows machine, try running the Dockerized version on WSL. The logs on the WSL terminal can contain more information.

docker build -t triggers . && docker run -it triggers