Container Inspection & Logs in Docker
From the Docker cheat sheet · Container Management · verified Jul 2026
Container Inspection & Logs
Debug and inspect running containers for troubleshooting
bash
# View logs
docker logs container_name
docker logs -f container_name # Follow
docker logs --tail 50 container_name # Last 50 lines
# Execute commands
docker exec container_name ls
docker exec -it container_name bash
# Inspect container
docker inspect container_name
# Copy files
docker cp container:/path/file local/path
docker cp local/file container:/path/💡 Use -f to follow logs in real-time
📌 docker exec -it for interactive sessions
⚡ Inspect with --format for specific fields
✅ Copy files without stopping container