First Thoughts on Docker (and how it works with Chef)

While some of you have been more rapid in your acclimation and introduction with Docker, I have been taking a cautionary, slow approach to using it. After all, I have focused a lot of my time on mastering Chef, so abandoning that to learn Docker seemed like a waste of previous effort. My solution was to simply make sure that I learned Docker from a Chef users standpoint. These are some of my immediate takeaways. 

  • The Docker community cookbook is an excellent tool. 

Overall, I have denounced community cookbooks as overly complicated bits of spaghetti code for the novice, and I still stand by that statement. However when I gave it an initial shot I found incredibly easy to use. There are built in resources for downloading images, creating containers, and all of them have highly usable attributes for almost all the docker subcommands. I originally started with Ansible to install Docker thinking it would be easier, and it is simply not the case. The community cookbook is a good tool that will tie into your existing code setup.

  • Using the cookbook is not a substitute for understanding Docker

This falls more in line with my normal community cookbook thinking. While Docker is a relatively shallow API, it is still an alien concept to traditional config management, and there is a learning curve to undersanding the underlying principles of LXC containers. You would be wise to get a solid grasp of Docker and linux containers before trying to implement them with Chef. Some key concepts include
- VM host vs. docker image vs. Docker containers
- How to effectively run multiple containers on the same system. 
- Volume Mounting to efffectively use external data on containers. 
- Effective use of container tagging for management.
- Dockerfiles, and their importance on building custom images. 

The Docker documentation is pretty extensive on the home page and is a good reference tool for that, so I will skip rehashing it.

  • Once you have the basics, the Docker cookbook is a helpful tool.

This is more opinion than fact. I found that after grasping the basics of Docker, using the LWRP attributes for containers made it much easier to learn the subcommands required to effectively use linux containers. Secondly, having it as more human readable code made it much easier than long command line entries. 

  • There are some things the Docker cookbook can't do. 

Okay, I'll rephrase this slightly. There aren't many things it can't do, in fact there was only one that really bothered me. That is the inability to setup persistent data containers for setting up clusters which require that. This is more related to. 

  1. Persistent data containers are not the current standard practice (not best practice)
  2. Everybody that is all about Docker is ignoring the elephant in the room of the data problem.

This will likely be a problem fixed when a best practice is adopted with container data management, but for now it remains a problem for you and homemade bash scripts. 

  • In summary, stick with the Docker cookbook for now

Another biased opinion. If you are a relative Docker and Chef novice, stick with the community cookbook only starting off! I have read some of the things involving knife-container and how to use your existing cookbooks to adjust run-state of containers, but it is not for the faint of heart. Stick with the basics, and when you are comfortable build on it from there. 

Keep calm, and Chef/Docker on.