Skip to content

Instantly share code, notes, and snippets.

@duskvirkus
Last active September 25, 2025 15:42
Show Gist options
  • Select an option

  • Save duskvirkus/87bd76c708b947c0d9f525efc29c5821 to your computer and use it in GitHub Desktop.

Select an option

Save duskvirkus/87bd76c708b947c0d9f525efc29c5821 to your computer and use it in GitHub Desktop.
debug docker image file system by entering at shell

How to debug a docker container by entering the shell because I always forget

If not already a service add keep alive to the Dockerfile

ENTRYPOINT ["tail", "-f", "/dev/null"]

Then to enter shell do the following

docker build --no-cache --progress plain -t imagetodebug .
docker run imagetodebug &
# get last launched container
export docker_container=$(docker ps -lq) && echo $docker_container
docker exec -ti $docker_container /bin/bash

After done

exit
docker stop $docker_container
docker rm $docker_container
docker image rm imagetodebug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment