Docker
https://github.com/docker/cli https://github.com/docker/compose
Docker is a platform for developing, shipping, and running applications in containers.
Vortex provides a configuration for Docker and Docker Compose to run the project in all environments using containers.
Special thanks to Lagoon for providing the container images that make this possible.
Lagoon images run in production environments, receive regular updates, and are maintained by the Lagoon team.
If you are using Lagoon as your hosting provider, then all of your environments are using identical images to run the project.
About Docker and Docker Compose
Below is a brief overview of Docker and Docker Compose. For more information, see the official documentation.
Docker lets you define services such as a web server or a database server as standalone containers, which then run in an isolated environment and can talk to each other.
The containers are started from images - templates that define what is installed in the container and how it is configured - so every container starts with consistent content and configuration.
Docker is the engine that runs containers built from images, letting them share
host system resources and communicate with each other. When run locally, Docker
is controlled with the Docker CLI command, docker.
Docker Compose describes a multi-container Docker application in a single
docker-compose.yml file: all the containers that work together are defined in
one place, which makes them easier to manage.
When working with Drupal, which requires multiple service containers, a
developer would normally use the Docker Compose CLI (docker compose) rather
than the Docker CLI. These commands run in the context of the current
directory, so run them from the project root: they only affect the containers
defined in the docker-compose.yml file there, not other containers running on
the host.
When a project is fully configured, the usage of Docker-based application comes down to a handful of commands to manage the state of the containers (per project):
docker compose up -d- start the containers in the background.docker compose down- stop and remove the containers.docker compose exec <service>- run a command in a running<service>container.docker compose logs -f- follow the logs of all the containers.docker compose ps- list all running containers.
More advanced commands are normally used when adjusting the project Docker configuration and services.
Using Docker
Vortex uses Docker to run the project in a containerized environment locally and in the continuous integration pipeline.
Some of the commands are wrapped in the Ahoy script as a shorthand. But all
the commands can be run directly using docker compose command.
Specific commands are described in the relevant Development documentation.
Understanding docker-compose.yml
Docker Compose reads the configuration from the docker-compose.yml and
docker-compose.override.yml files. The configuration files are written in
YAML, which support anchors and references
that help to reduce duplication.
The file provided by Vortex contains the following sections: