Docker is awesome, but some common things aren't one-liners. And they should be.
I've been playing around with Docker recently. Here are some tricks I've developed to avoid thinking.
First Time (Linux only):
sudo apt-get install docker
First Time (OSX only):
brew install boot2docker docker boot2docker init boot2docker up # You're gonna have to wait here, probably less than 30 seconds. # When you get a prompt back, you're ready to roll.
for new shells (Linux only) (Hint: Just put this in your .bashrc file):
alias last_img='docker images|head -2|tail -1|cut -c41-51' alias last_run='docker ps|head -2|tail -1|cut -d\ -f1'
for new shells (OSX only) (Hint: Just put this in your .bashrc file):
$(boot2docker shellinit 2>/dev/null) alias last_img='docker images|head -2|tail -1|cut -c41-51' alias last_run='docker ps|head -2|tail -1|cut -d\ -f1'
to build an image from './Dockerfile'
docker build .
to run a new image interactively (it hears ^C)
docker run -p 8500:8500 -p 8088:8088 -p80:80 -it $(last_img)
to run a shell in the last running instance
docker exec -it $(last_run) bash
build && run interactively (^C works)
docker run -p 8088:8088 -p 8500:8500 -p 6500:6500 -p 80:80 -it $(docker build . | tail -1 | cut -c20-)
make a simple web container
git clone https://github.com/val314159/pydocker cd pydocker docker build .