django errors using boot2docker tutorial

If you are doing the docker-compose / boot2docker tutorial on the docker site at:

https://docs.docker.com/compose/django/

There are a few typos and items that will stop you, at least on a Mac although I suspect they are an issue on a PC as well. These are my notes, out of context but hopefully they will help someone else having problems with errors and configuration of Django Dockers for their dev environment.

boot2docker up
docker-compose up
# the following line runs it in the background
docker-compose up -d
To connect the Docker client to the Docker daemon, please set:
 export DOCKER_HOST=tcp://192.168.59.103:2376
# this tells you your environment variables
docker-machine env
http://192.168.59.103:5000/
# The following is incorrect in the docs
docker-compose run web python composeexample/manage.py syncdb

Rough notes, but hopefully enough to help you google for more if you are hitting the same wall I did with boot2docker and docker-compose for Django.

Update: also helpfule https://github.com/ambitioninc/container-transform

boot2docker – simplify working with docker containers on a mac

/Geek Warning – all others flee and hide to avoid boredom./

Boot2Docker is a wrapper that makes working with dockers on a local computer just a bit easier.

That’s the goal. Keep it simple and it works. If we really want to keep it simple we now have kitematic to run docker containers with a GUI.

GUI for Docker Container Development
GUI for Docker Container Development

Plus people in programming mode sometimes get insecure and like to (seriously) debate Vi or Emacs as if those who don’t know it are of a lesser kind. I believe in letting compilers deal with my long select-case/kwargs/collections/dictionaries/whatever you want to call them. Thus I LOVE seeing tools that make programming EASIER. Especially visual ones even though I’m back to preferring the command line.

But back to boot2docker for working with containers locally. On a Mac, it’s nothing most of us haven’t done already with Virtual Box (free) or VMWare (not free but faster than VB) sharing a local folder into the VM. We all do this so we can use our dev tools without even more junk into the VM itself.

Number 1 reason to use it if you use a Mac? It doesn’t make me install homebrew (not a fan – sorry) and mess up the $PATH on my Macs. And Containers are just cleaner than virtualenvs as there are no dependencies, only attached containers. ‘Tis beautiful.

OK, the point of this post – if you are having any problems installing boot2docker on your Mac as I did, first it probably is NOT your fault. OK, well maybe it is because we all like bright shiny things and have a ton of junk installed. For me I would install it and it just would not start up. I found the documentation sort of glazed over a few things. So here you go.

  1. Upgrade to the latest Virtual Box BEFORE installing boot2docker. For me it just hung and didn’t give me a clue what the problem was. Do this first.
  2. Let b2d put its .pem and other keys where it wants to. You don’t need to even put these in your .ssh folder either.
  3. I did put it’s three environment variables in my bash because I’m lazy.
  4. You don’t have to sudo when you call “boot2docker up”. It doesn’t like that.
  5. You don’t have to make an entry in your /etc/hosts file for the dev server. Maybe more convenient but the IP works just as well.
  6. SSH – I made this waaaay 2 complex. it’s like vagrant. Just type “boot2docker up” followed by “boot2docker ssh” and you are in.

boot2docker-self-sufficient-runtime

Again – keep it simple and don’t make life complicated like I did. Install the boot2docker app for mac from the site. Install the package for Mac. Then from terminal:

boot2docker init

You only have to run that once. Then from anywhere:

boot2docker up
boot2docker ssh
exit
boot2docker down

Of course you might want to try out some of the exercises after the “boot2docker ssh” line when you are in the environment. Just trying to keep things simple, but no simpler than needed.