Container technologies, like Docker, are making their appearance in many technology shops across the globe. Come see some of my use cases for it and how “Dockerizing” things can be both fun and challenging. I am hoping that as a working technologist, you will find some use cases of your own and at the very least, it should provoke thought into how you are currently developing your tools or services within your own technology stacks.
Presentation given 11/16/2015
https://www.docker.com/what-docker
- Install with Home Brew / Home Brew Cask
- Install with the Docker Toolbox
- docker engine (daemon)
- docker-machine
- docker-compose
- docker kitematic
- VirtualBox
Creating a new docker machine:
docker-machine create -d virtualbox demo
Setting the active docker machine:
eval "$(docker-machine env demo)"
Verify that we have things setup for us:
docker-machine ls #shows that we have the demo machine created/running
docker version #verifies that we have docker working for us
Let's go out and get wordpress:
docker pull tutum/wordpress
Let's spin up our own wordpress instance:
docker run -d -p 1337:80 tutum/wordpress
Note: If you don't have the image locally...no worries, it'll pull it down for us automagically before it goes to run it.
Navigate to that instance in the browser:
open http://$(docker-machine ip demo):1337
GoTodo Application - Just a toy application we want to "Dockerize".
Using the docker-compose.yml file we can simply run this to bring everything online:
docker-compose up -d
When we are done, we can run the following items:
docker-compose stop
docker-compose rm
Note: You can supply the -f flag on rm to not be prompted.
Docker Compose does a lot of the heavy lifting for us...linking the containers together, managing environment variables, using specific commands, etc. Your use case will vary, but you will see the power of it the more you use it.
- Jenkins builds docker images, then puts them in docker registry. Some of my apps I do have a full deploy setup, meaning it connects to the target machine via ssh, then runs the associated docker commands on that target (docker pull, docker run, etc).
- Respective system can just
docker pull mylocalrepo/myapp
, thendocker run
it to have it ready to go - Authorized users can also pull these images locally from the private repository
Once you have a docker image...you can interact with container engines/schedulers which will do different things for you. For example, auto-scaling your application or setting up infrastructure/platform type things are two basic examples. Notice the docker image piece plugs into how the manifest/task files are setup, so it proves that once you have Docker down...you evolve into bigger things quickly.
- Feel free to ask me on Twitter @mickelmr
- Thank you!
Here's a flowchart I made for this presentation, but I never used:
It reads from bottom to top.