LinuxAlternative

Linux · Ferramentas do Sistema

Docker Compose

A standalone command-line tool for defining and running multi-container Docker applications using a single YAML file.

Código abertoGrátis
Seja o primeiro a avaliar
Licença
Apache-2.0
Versão mais recente
5.6.1

O que é o Docker Compose?

Docker Compose is a mature, industry-standard tool for orchestrating multi-container applications. Originally a separate Python project, it was rewritten in Go and later integrated directly into the Docker CLI as a plugin. It reads a docker-compose.yml file to define services, networks, and volumes, allowing you to bring up complex stacks with a single command. It has been stable and widely adopted for over a decade.

Ideal para: Developers and sysadmins who need to define and run multi-container applications locally or in simple production environments.

Principais recursos do Docker Compose

  • Define multi-container applications in a single YAML file
  • Manage service dependencies and startup order
  • Create isolated networks and volumes for data persistence
  • Scale services horizontally with a single command
  • View logs from all services in one terminal
  • Supports profiles to enable or disable optional services
  • Compatible with standard Docker CLI commands

Prós

  • No GUI overhead, runs directly on the host
  • Declarative configuration is easy to version control
  • Consistent behavior across Linux, macOS, and Windows
  • Tightly integrated with the standard Docker CLI

Contras

  • No graphical interface for visualizing the stack
  • YAML syntax can be tricky to debug if indentation is wrong
  • Not designed for large-scale production orchestration

Programas do Windows que o Docker Compose substitui

Como instalar o Docker Compose no Linux

Ubuntu / Mintsudo apt install docker-compose-v2
Debiansudo apt install docker-compose
Fedorasudo dnf install docker-compose
Arch / Manjarosudo pacman -S docker-compose
openSUSEsudo zypper install docker-compose

Dicas para quem vem do Windows

Your docker-compose.yml files from Docker Desktop work exactly the same on Linux. The main difference is that you do not have a GUI to click 'Start' or 'Stop'. Instead, use docker compose up -d to start in the background and docker compose down to stop and remove containers. If you were using the Docker Desktop dashboard to view logs, use docker compose logs -f in your terminal. Ensure your user is in the docker group to avoid using sudo for every command.

Docker Compose: perguntas frequentes

Do I need Docker Desktop to use Compose on Linux?

No. Docker Compose is a standalone tool that works directly with the Docker Engine. You only need the Docker CLI and Engine installed.

What is the difference between `docker-compose` and `docker compose`?

docker compose is the current, recommended way to run it as a CLI plugin. docker-compose is the legacy standalone binary, which is still supported but no longer the primary development focus.

Can I use Compose for production?

Yes, for small to medium-sized applications. For large, highly available clusters, Kubernetes is typically preferred, but Compose is perfectly fine for many production workloads.

How do I update my services after changing the YAML file?

Run docker compose up -d again. It will detect the changes and recreate only the affected containers, preserving your data if volumes are configured.

Atualizado em