Skip to content

Instantly share code, notes, and snippets.

@Jim-Holmstroem
Created May 29, 2015 13:03
Show Gist options
  • Save Jim-Holmstroem/83af08165d4515aa34ea to your computer and use it in GitHub Desktop.
Save Jim-Holmstroem/83af08165d4515aa34ea to your computer and use it in GitHub Desktop.
docker debug wrapper, intended to be used with ubuntu:14.04 base image. It's easy to change what is to be included. It compiles a debug layer on top of the image specified and then runs it with -it bash. Add it to .bashrc if you want to have it in all your terminal sessions (ubuntu host specific). In it's current form (easy to change) it require…
function docker_debug { ([[ "$1" =~ ":" ]] || (echo "Failed. Specify tag" && false)) && echo -e "FROM $1\nUSER root\nRUN apt-get install --assume-yes ipython htop tcptrack tmux man\nRUN pip install cqlsh" | docker build -t $1-dbg - && docker run -it ${*:2} $1-dbg bash;};
@Jim-Holmstroem
Copy link
Author

Usage:

docker_debug <container>:<tag> <run parameters>
docker_debug container:tag -p 5000:5000

It builds an image container:tag-dbg which runs in sudo and has some debugging tools installed

docker_debug <image>:<tag> <parameters>  # compiles and runs =>
docker run -it <parameters> <image>:<tag>-dbg bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment