Maintain Docker¶
Troubleshoot¶
If a container fails to start with:
runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
Force the image to rebuilt on GitHub, then re-deploy the application.
If the issue persists, check whether free memory is low or there’s a hardware issue.
Get basic information¶
docker system info
Tip
To troubleshoot docker compose
commands, add the --verbose
option.
Reference: Overview of docker compose CLI
Review log files¶
Run, replacing CONTAINER
:
docker compose logs -f -t CONTAINER
Container logs are cleared when containers are restarted or recreated.
To read historic container logs, replacing CONTAINER
:
less /var/log/docker-custom/CONTAINER.log
Open a shell¶
Open a Bash shell, for example:
docker compose run --rm --name my-app-shell static bash
Open a Python shell, for example:
docker compose run --rm --name my-app-shell cron python manage.py shell
Our Python projects follow a LOG_LEVEL
environment variable, which you can set with -e LOG_LEVEL=DEBUG
, for example.
Check project usage¶
Show containers’ status:
docker compose ps
Show containers’ processes:
docker compose top
Check system-wide usage¶
Check drive usage:
docker system df
List containers, images, networks and volumes:
docker container ls -a
docker image ls -a
docker network ls
docker volume ls
Inspect a volume, replacing VOLUME
:
docker volume inspect VOLUME
List a volume’s data, replacing VOLUME
:
ls /var/lib/docker/volumes/VOLUME/_data/*