Docker compose

ยท

1 min read

Why use docker compose ?

  • Easy set up : it simplifies setting up and running multi-container application with single config

  • consistent development : use it for consistent development env

๐Ÿ‘‰๐Ÿป Docker Version 3

In docker compose v3, every container defined in docker compose share common network and they can be connected via hostname

docker compose.yaml

version: "3"
services:
    drupal:
        images: "drupal"
        port:
           - 80:80
        environment:
            - name="abc"
     custom:
         build: .
         port:
            - 81:3930
          restart: on-failur:5

docker compose cli

docker compose up

start all container

docker compose down

stop all container

docker stop service_name

stop individual container

docker start service_name

start individual container

docker compose ps

list of container

docker compose up -build

build and run

ย