awesome-compose Documentation

Awesome Docker Compose samples

46,069 stars HTML HTML 1 file ยท ~5,924 tokens #awesome#awesome-list#docker-compose
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy awesome-compose on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name awesome-compose -p 4200:4200 --restart always docker/awesome-compose:latest
Configured Services & Ports
โš™๏ธ web
image: build locally
๐Ÿ”Œ Ports: 4200:4200
docker-compose.yml
yaml (docker-compose.yml)
services:
  web:
    build:
      context: angular
      target: builder
    ports:
      - 4200:4200
    volumes:
      - ./angular:/project
      - /project/node_modules

1. Project Overview & Quickstart (docker/awesome-compose)

File: README.md

Awesome Compose [](https://awesome.re)

A curated list of Docker Compose samples.

These samples provide a starting point for how to integrate different services using a Compose file and to manage their deployment with Docker Compose.

Note
The following samples are intended for use in local development environments such as project setups, tinkering with software stacks, etc. These samples must not be deployed in production environments.

Contents

Samples of Docker Compose applications with multiple integrated services

Icon indicates Sample is compatible with Docker+Wasm.

Single service samples

Basic setups for different platforms (not production ready - useful for personal use)

Getting started

These instructions will get you through the bootstrap phase of creating and
deploying samples of containerized applications with Docker Compose.

Prerequisites

Running a sample

The root directory of each sample contains the compose.yaml which
describes the configuration of service components. All samples can be run in
a local environment by going into the root directory of each one and executing:

console
docker compose up -d

Check the README.md of each sample to get more details on the structure and
what is the expected output.
To stop and remove all containers of the sample application run:

console
docker compose down

Quickstart guides

In addition to all the ready to run Compose samples listed above the folder official-documentation-samples contains quickstart guides. Each of these step by step guides explain which files need to be created to build and run a Docker Compose application.

Contribute

We welcome examples that help people understand how to use Docker Compose for
common applications. Check the Contribution Guide for more details.


File: angular/angular/README.md

Angular

This project was generated with Angular CLI version 13.0.1.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.


File: angular/README.md

Compose sample

Angular service

Project structure:

text
.
โ”œโ”€โ”€ angular
โ”‚ย ย  โ”œโ”€โ”€ Dockerfile
โ”‚ย ย  โ”œโ”€โ”€ ...
โ”‚ย ย  โ”œโ”€โ”€ ...
โ”‚ย ย  ....
โ””โ”€โ”€ compose.yaml

compose.yaml

text
services:
  web:
    build: angular
    ports:
    - 4200:4200
    ...

The compose file defines an application with one service angular. The image for the service is built with the Dockerfile inside the angular directory (build parameter).

When deploying the application, docker compose maps the container port 4200 to the same port on the host as specified in the file.
Make sure port 4200 is not being used by another container, otherwise the port should be changed.

Deploy with docker compose

text
$ docker compose up -d
Creating network "angular_default" with the default driver
Building angular
Step 1/7 : FROM node:10
10: Pulling from library/node
c0c53f743a40: Pull complete
...
...
Successfully built efea5cef6851
Successfully tagged angular_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating angular_web_1 ... done

Expected result

Listing containers must show a container running and the port mapping as below:

text
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
6884c228388e        angular_web         "docker-entrypoint.sโ€ฆ"   42 seconds ago      Up 36 seconds       0.0.0.0:4200->4200/tcp angular_web_1

After the application starts, navigate to http://localhost:4200 in your web browser.

Stop and remove the container

text
$ docker compose down

File: apache-php/README.md

Compose sample application

PHP application with Apache2

Project structure:

text
.
โ”œโ”€โ”€ compose.yaml
โ”œโ”€โ”€ app
 ย ย  โ”œโ”€โ”€ Dockerfile
 ย ย  โ””โ”€โ”€ index.php

compose.yaml

text
services:
  web:
    build: app
    ports: 
      - '80:80'
    volumes:
      - ./app:/var/www/html/

Deploy with docker compose

text
$ docker compose up -d
Creating network "php-docker_web" with the default driver
Building web
Step 1/6 : FROM php:7.2-apache
...
...
Creating php-docker_web_1 ... done

Expected result

Listing containers must show one container running and the port mapping as below:

text
$ docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                  NAMES
2bc8271fee81        php-docker_web               "docker-php-entrypoiโ€ฆ"   About a minute ago  Up About a minute   0.0.0.0:80->80/tc    php-docker_web_1

After the application starts, navigate to http://localhost:80 in your web browser or run:

text
$ curl localhost:80
Hello World!

Stop and remove the containers

text
$ docker compose down

File: aspnet-mssql/README.md

Compose sample application: ASP.NET with MS SQL server database

Project structure:

text
.
โ”œโ”€โ”€ app
โ”‚ย ย  โ”œโ”€โ”€ aspnetapp
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ appsettings.Development.json
|   |   โ””โ”€โ”€ ...
โ”‚ย ย  โ”œโ”€โ”€ ...
โ”‚ย ย  โ””โ”€โ”€ Dockerfile
โ””โ”€โ”€ compose.yaml

compose.yaml

text
services:
  web:
    build: app
    ports:
    - 80:80
  db:
    # mssql server image isn't available for arm64 architecture, so we use azure-sql instead
    image: mcr.microsoft.com/azure-sql-edge:1.0.4
    # If you really want to use MS SQL Server, uncomment the following line
    #image: mcr.microsoft.com/mssql/server
    ...

The compose file defines an application with two services web and db. The image for the web service is built with the Dockerfile inside the app directory (build parameter).

When deploying the application, docker compose maps the container port 80 to port 80 of the host as specified in the file.
Make sure port 80 on the host is not being used by another container, otherwise the port should be changed.

โ„น๏ธ INFO
For compatibility purpose between AMD64 and ARM64 architecture, we use Azure SQL Edge as database instead of MS SQL Server.
You still can use the MS SQL Server image by uncommenting the following line in the Compose file
#image: mcr.microsoft.com/mssql/server

Deploy with docker compose

text
$ docker compose up -d
Creating network "aspnet-mssql_default" with the default driver
Building web
Step 1/13 : FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
2.1: Pulling from dotnet/core/sdk
....
....
a9dca2f6722a: Pull complete
Digest: sha256:9b700672670bb3db4b212e8aef841ca79eb2fce7d5975a5ce35b7129a9b90ec0
Status: Downloaded newer image for microsoft/mssql-server-linux:latest
Creating aspnet-mssql_web_1 ... done
Creating aspnet-mssql_db_1  ... done

Expected result

Listing containers must show two containers running and the port mapping as below:

text
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
7f3a2a7ea5c0        microsoft/mssql-server-linux   "/opt/mssql/bin/sqlsโ€ฆ"   4 minutes ago       Up 4 minutes        1433/tcp             aspnet-mssql_db_1
27342dde8b64        aspnet-mssql_web               "dotnet aspnetapp.dll"   4 minutes ago       Up 4 minutes        0.0.0.0:80->80/tcp   aspnet-mssql_web_1

After the application starts, navigate to http://localhost:80 in your web browser.

Stop and remove the containers

text
$ docker compose down

File: django/README.md

Compose sample application

Django application in dev mode

Project structure:

text
.
โ”œโ”€โ”€ compose.yaml
โ”œโ”€โ”€ app
 ย ย  โ”œโ”€โ”€ Dockerfile
 ย ย  โ”œโ”€โ”€ requirements.txt
 ย ย  โ””โ”€โ”€ manage.py

compose.yaml

text
services: 
  web: 
    build: app 
    ports: 
      - '8000:8000'

Deploy with docker compose

text
$ docker compose up -d
Creating network "django_default" with the default driver
Building web
Step 1/6 : FROM python:3.7-alpine
...
...
Status: Downloaded newer image for python:3.7-alpine
Creating django_web_1 ... done

Expected result

Listing containers must show one container running and the port mapping as below:

text
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
3adaea94142d        django_web          "python3 manage.py rโ€ฆ"   About a minute ago   Up About a minute   0.0.0.0:8000->8000/tcp   django_web_1

After the application starts, navigate to http://localhost:8000 in your web browser:

Stop and remove the containers

text
$ docker compose down

File: elasticsearch-logstash-kibana/README.md

Compose sample application

Elasticsearch, Logstash, and Kibana (ELK) in single-node

Project structure:

text
.
โ””โ”€โ”€ compose.yaml

compose.yaml

text
services:
  elasticsearch:
    image: elasticsearch:7.8.0
    ...
  logstash:
    image: logstash:7.8.0
    ...
  kibana:
    image: kibana:7.8.0
    ...

Deploy with docker compose

text
$ docker compose up -d
Creating network "elasticsearch-logstash-kibana_elastic" with driver "bridge"
Creating es ... done
Creating log ... done
Creating kib ... done

Expected result

Listing containers must show three containers running and the port mapping as below:

text
$ docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                    PORTS                                                                                            NAMES
173f0634ed33        logstash:7.8.0        "/usr/local/bin/dockโ€ฆ"   43 seconds ago      Up 41 seconds             0.0.0.0:5000->5000/tcp, 0.0.0.0:5044->5044/tcp, 0.0.0.0:9600->9600/tcp, 0.0.0.0:5000->5000/udp   log
b448fd3e9b30        kibana:7.8.0          "/usr/local/bin/dumbโ€ฆ"   43 seconds ago      Up 42 seconds             0.0.0.0:5601->5601/tcp                                                                           kib
366d358fb03d        elasticsearch:7.8.0   "/tini -- /usr/localโ€ฆ"   43 seconds ago      Up 42 seconds (healthy)   0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp                                                   es

After the application starts, navigate to below links in your web browser:

Stop and remove the containers

text
$ docker compose down

Attribution

The example Nginx logs are copied from here.


File: fastapi/README.md

Compose sample application

Python/FastAPI application

Project structure:

text
โ”œโ”€โ”€ compose.yaml
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ app
 ย ย  โ”œโ”€โ”€ main.py
 ย ย  โ”œโ”€โ”€ __init__.py

compose.yaml

text
services:
  api:
    build: .
    container_name: fastapi-application
    environment:
      PORT: 8000
    ports:
      - '8000:8000'
    restart: "no"

Deploy with docker compose

shell
docker-compose up -d --build

Expected result

Listing containers must show one container running and the port mapping as below:

text
$ docker ps
CONTAINER ID   IMAGE          COMMAND       CREATED              STATUS              PORTS                                               NAMES
7087a6e79610   5c1778a60cf8   "/start.sh"   About a minute ago   Up About a minute   80/tcp, 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp   fastapi-application

After the application starts, navigate to http://localhost:8000 in your web browser and you should see the following json response:

text
{
"message": "OK"
}

Stop and remove the containers

text
$ docker compose down

File: flask/README.md

Compose sample application

Python/Flask application

Project structure:

text
.
โ”œโ”€โ”€ compose.yaml
โ”œโ”€โ”€ app
 ย ย  โ”œโ”€โ”€ Dockerfile
 ย ย  โ”œโ”€โ”€ requirements.txt
 ย ย  โ””โ”€โ”€ app.py

compose.yaml

text
services: 
  web: 
    build:
     context: app
     target: builder
    ports: 
      - '8000:8000'

Deploy with docker compose

text
$ docker compose up -d
[+] Building 1.1s (16/16) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                       0.0s
    ...                                                                                                                                         0.0s
 => => naming to docker.io/library/flask_web                                                                                                                                                                                               0.0s
[+] Running 2/2
 โ ฟ Network flask_default  Created                                                                                                                                                                                                          0.0s
 โ ฟ Container flask-web-1  Started

Expected result

Listing containers must show one container running and the port mapping as below:

text
$ docker compose ps
NAME                COMMAND             SERVICE             STATUS              PORTS
flask-web-1         "python3 app.py"    web                 running             0.0.0.0:8000->8000/tcp

After the application starts, navigate to http://localhost:8000 in your web browser or run:

text
$ curl localhost:8000
Hello World!

Stop and remove the containers

text
$ docker compose down

File: flask-redis/README.md

Compose sample application

Python/Flask application using a Redis database

Project structure:

text
.
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ compose.yaml
โ””โ”€โ”€ requirements.txt

compose.yaml

text
services:
   redis: 
     image: redislabs/redismod
     ports:
       - '6379:6379' 
   web:
        build: .
        ports:
            - "8000:8000"
        volumes:
            - .:/code
        depends_on:
            - redis

Deploy with docker compose

text
$ docker compose up -d
[+] Running 24/24
 โ ฟ redis Pulled   
 ...                                                                                                                                                                                                                                                                                                                                                                                                             
   โ ฟ 565225d89260 Pull complete                                                                                                                                                                                                      
[+] Building 12.7s (10/10) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                  ...
[+] Running 3/3
 โ ฟ Network flask-redis_default    Created                                                                                                                                                                                             
 โ ฟ Container flask-redis-redis-1  Started                                                                                                                                                                                             
 โ ฟ Container flask-redis-web-1    Started

Expected result

Listing containers must show one container running and the port mapping as below:

text
$ docker compose ps
NAME                  COMMAND                  SERVICE             STATUS              PORTS
flask-redis-redis-1   "redis-server --loadโ€ฆ"   redis               running             0.0.0.0:6379->6379/tcp
flask-redis-web-1     "/bin/sh -c 'python โ€ฆ"   web                 running             0.0.0.0:8000->8000/tcp

After the application starts, navigate to http://localhost:8000 in your web browser or run:

text
$ curl localhost:8000
This webpage has been viewed 2 time(s)

Monitoring Redis keys

Connect to redis database by using redis-cli command and monitor the keys.

text
redis-cli -p 6379
127.0.0.1:6379> monitor
OK
1646634062.732496 [0 172.21.0.3:33106] "INCRBY" "hits" "1"
1646634062.735669 [0 172.21.0.3:33106] "GET" "hits"

Stop and remove the containers

text
$ docker compose down

2. Official Technical Reference & Guides (docker/docs)

Docs @ Docker

Welcome to the Docker Documentation repository. This is the source for the Docker Docs Website.

Feel free to open pull requests or issues. Our docs are completely open source, and we deeply appreciate contributions from the Docker community!

Provide feedback

Weโ€™d love to hear your feedback! To submit feedback:

  • Click New issue on the docs repository, or
  • Click Request changes in the right column of every page on
    docs.docker.com, or
  • Click Give feedback on every page in the docs.

To get community support, use the Docker Community Slack. Personalized support is available
through the Docker Pro, Team, and Business subscriptions. See Docker
Pricing
for details.

If you have an idea for a new feature or behavior change in a specific aspect of
Docker or have found a product bug, file an issue in the project's
repository.

Contribute to Docker docs

We welcome contributions! To get started:

Copyright 2013-2026 Docker, Inc., released under the Apache 2.0 license.