Member-only story

Get to know Docker Compose

shazni nazeer
3 min readSep 23, 2019

--

Well, this is a short writing about what docker-compose is and how can it be a value addition to your docker tool set. If you need a quick refresh about docker I recommend you read my previous blog post about ‘Docker for Beginners’ here. Well, if you have followed along that blog post, you would have come across below github repository where I demonstrated the docker containers and related commands using a simple python flask application.

When using docker commands, you need to create a ‘Dockerfile’ to define an image and enter long docker commands to create and spin up containers. It’s often the case that you’ll need to do this multiple times. Command would be even longer if you need multiple containers to be spun up for the application. That’s what is simplified in docker-compose. It allows you to write a simple yaml configuration file to define multiple services. Then you can use a single command to spin up the necessary containers and services.

Let’s work on the same example above. The snippet for the api.py file is shown below for your ease.

--

--

No responses yet