Everyone is talking about Docker these days. Why another virtualization thing? Why should I bother— I’m happy with Bento and Vagrant?
I needed answers. The best way to get them was to install and play around with the tool.
This post will bring you up to speed in using Docker as fast as possible and provide some further pointers.
Before your first installation I recommend doing this interactive tutorial.
Installation
On my Mac, I basically had two options for installing Docker: either with boot2docker or in any other virtual machine, because there is no native way to install it on macOS.
At first I tried boot2docker but soon ran into limitations (no volume support) and switched to a Vagrant box that I had built as described here.
When the Vagrant box was up, I did the following:
yum -y install docker
service docker start
chkconfig docker on
docker run -i -t centos /bin/bashCongratulations! You are now in a shell of your first Docker container.
That was it — yes!
What’s Next?
Visit Docker Hub to find the Docker image that fits your needs.
As an alternative, start building your own Docker images: base images guide. Stay tuned — I ‘ve already drafted the next blog post that will explain how to build a custom image.
Takeaways
Key takeaways from my research and practical use:
- A container is not configured at run time. To persist configuration changes, build a new image; the current container is replaced by a new container based on that image.
- A container does one thing: for example, provide a database or serve a web site— not both at the same time.
The most important point that clarified things for me:
- When to use what? Use Vagrant to abstract a machine; use Docker to abstract an application. Yay!
Further Reading
- Solomon Hykes explains Docker
- Interactive Tutorial
- What is docker?
- Some Docker Tips and Tricks
- Should I use Vagrant or Docker.io for creating an isolated environment?
Done for today.