This article is the second part of our exploration of Docker caching — if you haven’t already, check out the  first part, where we introduced Docker layers and the caching mechanism. Let’s now have a look at Docker Compose and some of the challenges when using both Docker and Docker Compose at the same time.

Docker Compose Is a Great Dev Tool

We used docker build and docker run commands to build/run our application from a Docker image locally. If we had a project with multiple components (e.g., a client and a server), building and running each can quickly become cumbersome and inefficient. Luckily, there’s Docker Compose — a CLI tool designed for running multicontainer applications.

Docker Compose is completely separate from Docker but uses the Docker engine internally to orchestrate the building and running of multiple containers. An overview of Docker Compose and the installation instructions can be found on  the official website.

While each component will still have its own Dockerfile describing how the image should be built, we now also have a docker-compose.yml file — a YAML descriptor of all containers that need to be run together and its runtime properties.

#devops #docker-compose #javascript #docker

Sharing a Cached Layer Between Docker and Docker Compose Builds
2.90 GEEK