Skip to content

Instantly share code, notes, and snippets.

@rordi
Last active April 29, 2024 12:45
Show Gist options
  • Save rordi/259af9648aa1e257738401f2f2750d0c to your computer and use it in GitHub Desktop.
Save rordi/259af9648aa1e257738401f2f2750d0c to your computer and use it in GitHub Desktop.
Docker debugging an existing image

Debugging a Docker image

Start up the Docker container from image:

docker run --entrypoint "/bin/sh" --rm imagename:latest -c "sleep 24h"

Obtain the container hash id:

docker ps

Log into the running container using shell:

docker exec -ti containerid sh

Output logs of the container

docker logs -f containerid

Docker Prune All Untagged Images ("none")

docker rmi -f $(docker images -f "dangling=true" -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment