Playing with Docker Compose
• Mark Eschbach
I’ve long since been a fan of the ideas behind Docker. While using Docker to test my own systems I’ve had to do this awkward dance around setting up service in Jenkins to be tested then tear them donw. I’ve had my attention elsewhere and the systems have been relatively stable so I haven’t had a need to look into alternatives. I’m setting up my continous delivery pipeline for a new project so this was a chance to see what gains could be made. While searching for a solution this evening I came across Docker Compose and thought this would be an interesting expiriment to reduce the level of effort of testing my systems.
The tools dirves off of docker-compose.yml
which describes the pod of services to be run. The example looks fairly straight forward. In the case of my target application it’s backed by coucdb. So this is my first shot at the composition description:
version: '2'
services:
web:
build: .
ports:
- "9292:9292"
links:
- couch
couch:
image: couchdb:1.6.1
The hopes are the applications are started and run as expected. Well that worked out great! It did expose some problems with my application not using the correct environment variables though. Nor did it update the image after I corrected it. Sigh, alrighty. The bootstrapping might need some work. I’ve got the environment variables injected correctly, however now I have the initial system setup to do. I’m wondering what the best approach to scripting this would be. I think I’m going to create one in the current application container. Let’s see how to build it.
Bingo! docker-compe run
will run the target script which will run within the the pod. I’ll have to try it the next block of time I have for this project.