Docker - networks and volumes in practice
1. Retomando: de imagens bem construídas a containers que conversam entre si Os artigos anteriores desta série cobriram como criar imagens eficientes e rodar containers isolados. Mas uma aplicação real raramente é um único container: normalmente há uma API, um banco de dados, um cache, talvez uma fila de mensagens — cada um em seu próprio container, precisando se comunicar. E containers, por…
The article discusses how to enable communication between containers and persist data beyond the life of a container. By default, containers are isolated from each other and the host, and any data written to a container is lost when it is removed. To solve this, Docker provides user-defined networks and volumes. A user-defined network allows containers to communicate with each other, while a volume persists data outside the life cycle of a container.
The article explains how to create and manage networks and volumes, and how to use them to run a complete scenario with an API and a Postgres database communicating with each other and persisting data. Docker offers different network drivers, including bridge, host, none, and overlay, and two types of volumes: named volumes and bind mounts.
Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.