Docker: Getting to the container quickly

30 Sep 2017

Small barriers can really kill productivity. Recently I’ve been dealing with this a lot in Docker. Sometimes it’s that my Dockerfile isn’t building, sometimes it’s that the running container isn’t behaving how I was expecting, but every time I find myself needing to lookup the commands I need to start debugging.

This week I finally got sick of it and added a couple commands to my .bashrc to make my life better.

Insta

insta <image_name> spins up a container and drops you into the shell. This is handy both when your Dockerfile isn’t building and when you just need to get a quick instance of an image to see what the behavior is in it.

Dock

When your container is misbehaving sometimes you just have to take a look inside. That is what dock <container_name> gives you. If using docker-compose the container names are predictably <proj_dir>_<service>_<number>.