Skip to content
VDS · Docker and containers

Docker: troubleshooting common problems

A container keeps restarting, a port is in use, no space left, “permission denied”, a service can't see its neighbor — a table of symptoms and a troubleshooting procedure.

Updated August 23, 2026

Almost all container problems come down to a dozen common ones. Diagnosis always starts with the same three commands.

The first three commands

docker compose ps
docker compose logs --tail 100 <service>
docker inspect -f '{{.State.Status}} {{.State.ExitCode}} {{.State.OOMKilled}} {{.State.Error}}' <container>

Status, the last lines of the log, and the exit code answer most questions. After that, work from the symptom.

Symptom table

SymptomLikely causeWhat to do
Constantly RestartingThe application crashes on startupdocker compose logs --tail 200, read the first error, not the last
Exit code 137, OOMKilled: trueOut of memoryRaise the limit or find the leak, see resource limits
Exit code 1 immediately after startupError in configuration or variablesdocker compose config — check substitutions
port is already allocatedThe port is occupied by another processsudo ss -tulpn | grep :<port>
no space left on deviceOut of disk space or inodesdf -h and df -i, see disk space
permission denied on a volume fileUID mismatchdocker compose exec app id, then chown or PUID/PGID
The application cannot see the databaseDifferent networks or a request to localhostSee Docker networks
Cannot connect to the Docker daemonThe service is not running or you lack permissionssudo systemctl status docker, the docker group
Everything is slow, load is lowDisk bottleneckiostat -x 2, see disk speed

The container crashes, but the log is empty

This happens when the process dies before it can print anything. Run the image manually with a shell instead of the main command:

docker run --rm -it --entrypoint sh <image>

Inside, run the startup command by hand — the error will appear on the screen. While you are there, check whether the configuration files are in place:

docker compose run --rm app cat /app/config.yaml

Changes are not applied

The classic: you edit a file, restart, and nothing changes.

docker compose config          # does Compose see your changes
docker compose up -d --force-recreate app
docker compose exec app cat /etc/app/config.yaml

There are usually two causes: the file is mounted somewhere other than where you think, or the container sees a copy that got into the image during build.

Do not fix the problem with docker system prune -a. It removes unused images, networks, and the build cache, and with the --volumes flag, volumes with data as well. A volume becomes “unused” the moment its container is stopped. Figure out the cause first, then clean up.

When to clean up after all

docker system df
docker image prune
docker builder prune
docker container prune

docker system df will show what exactly is taking up space: images, build cache, volumes, or container logs. Usually the build cache is to blame — removing it is safe.

If the machine is unresponsive

SSH does not connect, the site does not open — usually a container has eaten up the memory and the system has gone into swap. Log in through the console in the machine panel. For htop and btop, you need the “Screen” mode: the window size is not passed over a text line, so it is always 80×24.

free -h
sudo dmesg -T | tail -40
sudo systemctl restart docker

If the system does not boot at all, switch the boot mode to the SystemRescue recovery disk in the “Access” tab: the machine will reboot into it, root login without a password, and the disk will be visible as /dev/sda. From there, you can mount the partition and retrieve the data.

What to check before, not after

  • Log size limits are set — see container logs.
  • Memory limits are set for all services.
  • Image versions are pinned, and the old image has not been deleted — see container updates.
  • A copy of the data exists and has been verified — see restore drill.