voroninman / docker-debug-image

🔧 A handy Docker image to troubleshoot from a Docker container.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker debug image

🔧 A handy Docker image to troubleshoot from a Docker container.

Usage

Locally:

docker run -ti --rm voroninman/debug bash

On Kubernetes:

kubectl run debug-shell --rm -it --image voroninman/debug -- /bin/bash

Advanced usage

Locally:

Get access to the host filesystem and network.

docker run -ti --rm --net host -v /:/host voroninman/debug bash

Get access to a container network and PIDs.

docker run -ti --rm \
	--pid container:$CONTAINER_ID \
	--net container:$CONTAINER_ID \
	--cap-add NET_RAW \
	--cap-add NET_ADMIN \
	--cap-add SYS_PTRACE \
	voroninman/debug bash

On Kubernetes:

If the EphemeralContainers feature is enabled, spawn a shell in the sidecar debugging container with the pod's network and PIDs.

kubectl debug $POD_NAME -ti \
	--image=voroninman/debug \
	--share-processes \
	-- bash

If the EphemeralContainers feature is disabled, run a copy of the pod first and then spawn a shell in the sidecar debugging container with the copied pod's network and PIDs.

kubectl debug $POD_NAME -ti \
	--image=voroninman/debug \
	--share-processes \
	--copy-to=$POD_NAME-debug \
	-- bash

# Cleanup when you're done
kubectl delete pod $POD_NAME-debug

About

🔧 A handy Docker image to troubleshoot from a Docker container.

License:MIT License


Languages

Language:Dockerfile 84.2%Language:Makefile 15.8%