Logs and Exec
Follow logs
Applications write to stdout and stderr; Docker captures that stream. Follow live output while reproducing a bug.
docker logs my-nginx
docker logs -f --tail 100 my-nginx
Logs with Compose
Name a service to focus, or omit it to see the whole stack.
docker compose logs -f web
Exec into a container
Start an interactive shell in a running container. Useful for checking files, packages, or connectivity.
docker exec -it my-nginx sh
Prefer logs first
Exec is powerful but temporary. Fix issues in the image, Compose file, or mounted config so the next container starts healthy without manual steps.
Comments
One comment per signed-in account. Comments are saved with this page’s URL.