Skip to content

Instantly share code, notes, and snippets.

@littlebeeper
Forked from rordi/docker-debug.md
Created November 4, 2023 18:28
Show Gist options
  • Save littlebeeper/1c9412a0e26fe7e8384050401069ecd5 to your computer and use it in GitHub Desktop.
Save littlebeeper/1c9412a0e26fe7e8384050401069ecd5 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/bash" --rm imagename:latest -c "sleep 24h"

Obtain the container hash id:

docker ps

Log into the running container

docker exec -ti containerid bash

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