Troubleshooting
See the stats
- Check CPU/Memory/Network information at real time in terminal
docker stats
See running containers
docker ps -a
Stop if container exits
docker compose up --abort-on-container-exit
Logs
# pipes you stderr/stdout
docker logs [service-name]
# tail logs
docker -f logs [service-name]
# tail from last 10 lines only
docker logs -f --tail 10 [service-name]
# attaches stdin/out/err and proxies signals
docker attach [service-name]
Inspect Docker Container
# other docker objects are also supported like network ids etc.
docker inspect <container-id/name>
Inspect Network
# list networks
docker network ls
docker network inspect <network-id>
Pause Unpause
docker pause [container]
docker unpause [container]
Execute commands
docker exec -it [container] bash
# Run as root
docker exec --user root -it [container] bash
- Container must be running to run commands
docker exec -it [container] touch /tmp/execWorks