A reference guide to the Docker and Docker Compose errors you're most likely to encounter, with direct fixes for each.
"docker: command not found"
Docker Engine isn't installed or isn't in your PATH.
docker --version
If this fails, follow How to Install Docker Engine on Ubuntu & Debian.
"docker compose: command not found"
The Compose plugin is missing:
sudo apt install docker-compose-plugin -y
"permission denied while trying to connect to the Docker daemon socket"
Your user isn't in the docker group:
sudo usermod -aG docker $USER
newgrp docker
Or use sudo for the command.
"Cannot connect to the Docker daemon"
The Docker service isn't running:
sudo systemctl status docker
sudo systemctl start docker
"Port is already allocated"
Another process is already using that port:
sudo ss -tulpn | grep :80
Either stop the conflicting service, or change the published port in your compose file:
ports:
- "8080:80"
YAML Parsing Errors
Compose files require consistent, space-only indentation — never tabs:
services:
nginx:
image: nginx
ports:
- "80:80"
Validate before starting:
docker compose config
"Container name already in use"
docker rm CONTAINER_NAME
Or choose a different name in your docker run command or compose file.
Image Not Found
Verify the exact image name and tag on Docker Hub, and try pulling manually to see the full error:
docker pull IMAGE_NAME
Container Keeps Restarting (Crash Loop)
docker logs CONTAINER_NAME
docker compose logs
This almost always reveals the actual application error causing the crash — a missing environment variable, bad config, or a dependency (like a database) not being ready yet.
"No space left on device"
Docker images and unused layers accumulate over time:
docker system df
docker system prune -a
Environment Variables Not Being Applied
Check that your .env file is in the same directory as docker-compose.yml, and confirm variable names match exactly (case-sensitive) between the file and the compose config.
Diagnostic Checklist
docker --versionanddocker compose version— confirm both are installeddocker ps -a— see all containers, including stopped ones, and their exit codesdocker logs CONTAINER_NAME— almost always the fastest way to find the root causedocker compose config— validate YAML syntax before startingsystemctl status docker— confirm the daemon itself is healthy
Related Articles
- How to Install Docker Compose on Ubuntu & Debian
- Docker Compose .env and Environment Variables
- Managing Docker Logs
