Posts

Showing posts from October, 2022

Common Docker Compose commands

Docker is fantastic tool to containerize a service and all it's dependencies. However, in practice rarely do you use a service by itself. Typically, you will have multiple services (or micro-services) collaborating to provide all the features of a customer facing application.  Docker compose is a tool from Docker that allows you to quickly and reliably spin up multiple containers locally on your Mac, Windows or Linux desktop. It provides constructs to: Put all the related containers in one docker-compose file Ensure they spin up in certain order (E.g. a database should be up before an application calls it) Are part of same local network so they can send API requests to each other Without Docker compose it would be quite a pain to do all the above yourself. Here are some commands i use frequently when running docker compose:  Let's say you modified one of the dockerfile or the service code. You then run the below command to build a new image: docker compose build <service_nam