Starting With Docker

#docker #sysadmin

This originally start off as a reference for building Rails 4 docker containers, but it ended up with me trying to move all my internal services to docker beforehand.

This was my first time using docker and it was a lot more involved than what I thought it would be.

Internal Services

I use Bitbucket Server for managing my source files, Buildbot for deploying projects, and Nginx as a front-end. There’s also an admin vm that runs things like backups.

Buildbot(master and slaves) and nginx are now running in their own docker containers. I was not able to reliably get the Bitbucket application server to respond to requests once running. I’ve had this issue before and I don’t think it’s specific to docker. It just gets to the point where all web requests timeout no matter how long I leave the service running. This issue did occur after moving the data directory and migrating the postgres db using the web interface to the docker containers.

Documentation

To start learning docker, I wanted to start off with one of the books I found on Amazon. I choose one that had a high rating and ordered it. This was mistake number one. It would have been a much better idea to start using docker’s online documentation instead. At the pace this project is moving, there are new things coming out constantly. After a couple of chapters, I just put the book away and used the online documentation.

Tools

After I thought I understood the basics, I wanted to try it out and start building containers. Mistake number 2. I didn’t get familiar with all of the tool offerings. For example, docker-compose and docker-machine.

Even though I ran into some issues that I’m not able to resolve regarding the configuration of docker-compose, it would have been an easier place to start instead of working directly with the docker command directly. After a while it became tedious and unnecessary. I spent a lot of time looking through my bash history trying to find which commands I’d used previously. It would have been easier working with a YAML file.

Conclusion

Once I got most everything working, it’s great. There were a lot of gotchas that caused great frustration (no dynamic dns on the default bridge, ipv6 showing up in netstat even though it’s really listening on ipv4 too, YAML syntax…), but I glad that I got it working for the most part. I would have mapped things out a little bit better and had goals written down if I had to do it again.