Managing Containers with Docker Compose

Milind Chavan
Oct 26, 2020

--

Compose is a tool for defining and running multi-container Docker applications.

Docker Compose

Very Important concepts to begin with:

From Web development standpoint, Docker compose is definitely one of the more exciting pieces of doctor. It’s a great way to automatically manage the life cycle of your application in the development environment and get it up and running and stop it.
With the docker-compose we can run it through a doctor compose build process. And this build process can actually generate images that we can then use to create containers.

Creating Docker-Compose File

Docker-Compose uses YAML files as inputs for creation of Services. The docker-compose file contain following fields : version, services, networks, etc. The example of docker-compose file:

ports:

- 5000

networks:

- aspnet-network

Once we have doctor-compose yaml file available, we can go into the terminal and run the doctor compose tool. That will automatically build or rebuild all of the different service images that we need that are all defined in our doctor-compose file.

?

1

$ docker-compose build

After creating the image, we can start up the container by just running up command

?

1

$ docker-compose up

And similiarly tear-down the created container with down command:

?

1

$ docker-compose down

For sample code project : Github Repo

--

--

Milind Chavan
Milind Chavan

Written by Milind Chavan

An Azurer, Web developer, Technologist, Writer, Poet, Runner. Opinions are my own.

No responses yet