Docker-Compose

Kleines Beispiel, wie die grundlegende Syntax eines Docker-Compose Deployments aussieht.

docker-compose.yml
version: '3'

services:
    container1:
        container_name: container1
        build: /path/to/directory_with_Dockerfile
        ports:
            - "8080:80"
    container2:
        container_name: container2
        image: "ubuntu:latest"
    container3:
        container_name: container3
        image: "ubuntu:latest"
        volumes:
            - </src/path/on/host>:</dst/path/in/container>
        environment:
            VAR1: content1
        restart: always
    container4:
        container_name: container4
        image: "ubuntu:latest"
        volumes:
            - vol1:/data/vol1
        depends_on:
            - container1
    container5:
        container_name: container5
        image: "ubuntu:latest"
        command: uname -a

volumes:
    vol1:
        driver: local