Working docker-compose and DockerFile examples to complement this information
Interesting tool to analyze custom Image layers size
Basic Definitions
Image Executable package that includes everything needed to run an application. It consists of read-only layers, each of which represent a DockerFile instruction. The layers are stacked and each one is a delta of changes from the previous layer.
Container Instance of an image.
Stack Defines the interaction of all the services
Services Image for a microservice which defines how containers behave in production
DockerFile File with instructions that allows us to build upon an already existing image. It defines:
- the base image to build from
- our own files to use or append
- the commands to run
At the end, a DockerFile will form a service, which we may call from docker-compose or standalone with docker build
.
DockerFiles vs docker-compose
A DockerFile is used when managing a single individual container. docker-compose is used to manage an application, which may be formed by one or more DockerFiles. Docker-compose may also be used as support to input large customization options, which otherwise would be parameters in a really long command.
You can do everything docker-compose does with just docker commands and a lot of shell scripting
Read More