Posts

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_na...

Docker commands I use Frequently

Image
Nowadays, docker is an integral part of software development. I use it regularly as part of my job and overtime i have found i use some commands lot more frequently compared to others. If you are new to Docker or revisiting docker after a while i hope you will find this list useful.  Setup :   1. Before launching any docker command on your terminal make sure you have downloaded,  installed and started   Docker Desktop  on your system (Mac/Windows/ Linux). 2. On a Mac you should see the docker icon come up in top right corner of status menu bar. Clicking on it you should confirm "Docker Desktop is running" message is appearing and a green icon next to it. Now you are all set to run the below commands. 3. Confirm docker is running well from command line by running below command in terminal:           docker  This should output commonly used docker commands and their brief description. Instead, if you get an error message  Cannot ...