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.
- Single service samples.
- Basic setups for different platforms (not production ready - useful for personal use).
Samples of Docker Compose applications with multiple integrated services
Icon indicates Sample is compatible with Docker+Wasm.
ASP.NET / MS-SQL- Sample ASP.NET core application
with MS SQL server database.Elasticsearch / Logstash / Kibana- Sample Elasticsearch, Logstash, and Kibana stack.Go / NGINX / MySQL- Sample Go application
with an Nginx proxy and a MySQL database.Go / NGINX / PostgreSQL- Sample Go
application with an Nginx proxy and a PostgreSQL database.Java Spark / MySQL- Sample Java application and
a MySQL database.NGINX / ASP.NET / MySQL- Sample Nginx reverse proxy with an C# backend using ASP.NET.NGINX / Flask / MongoDB- Sample Python/Flask
application with Nginx proxy and a Mongo database.NGINX / Flask / MySQL- Sample Python/Flask application with an Nginx proxy and a MySQL database.NGINX / Node.js / Redis- Sample Node.js application with Nginx proxy and a Redis database.NGINX / Go- Sample Nginx proxy with a Go backend.NGINX / WSGI / Flask- Sample Nginx reverse proxy with a Flask backend using WSGI.PostgreSQL / pgAdmin- Sample setup for postgreSQL database with pgAdmin web interface.Python / Flask / Redis- Sample Python/Flask and a Redis database.React / Spring / MySQL- Sample React
application with a Spring backend and a MySQL database.React / Express / MySQL- Sample React
application with a Node.js backend and a MySQL database.React / Express / MongoDB- Sample React
application with a Node.js backend and a Mongo database.React / Rust / PostgreSQL- Sample React
application with a Rust backend and a Postgres database.React / Nginx- Sample React application with Nginx.Spring / PostgreSQL- Sample Java application
with Spring framework and a Postgres database.WasmEdge / MySQL / Nginx- Sample Wasm-based web application with a static HTML frontend, using a MySQL (MariaDB) database. The frontend connects to a Wasm microservice written in Rust, that runs using the WasmEdge runtime.WasmEdge / Kafka / MySQL- Sample Wasm-based microservice that subscribes to a Kafka (Redpanda) queue topic, and transforms and saves any incoming message into a MySQL (MariaDB) database.
Single service samples
Basic setups for different platforms (not production ready - useful for personal use)
Gitea / PostgreSQLNextcloud / PostgreSQLNextcloud / Redis / MariaDBPi-hole / cloudflared- Sample Pi-hole setup with use of DoH cloudflared servicePrometheus / GrafanaWordpress / MySQL
Getting started
These instructions will get you through the bootstrap phase of creating and
deploying samples of containerized applications with Docker Compose.
Prerequisites
- Make sure that you have Docker and Docker Compose installed
- Windows or macOS:
Install Docker Desktop - Linux: Install Docker and then
Docker Compose
- Windows or macOS:
- Download some or all of the samples from this repository.
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:
docker compose up -dCheck 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:
docker compose downQuickstart 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:
.
โโโ angular
โย ย โโโ Dockerfile
โย ย โโโ ...
โย ย โโโ ...
โย ย ....
โโโ compose.yamlservices:
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
$ 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 ... doneExpected result
Listing containers must show a container running and the port mapping as below:
$ 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_1After the application starts, navigate to http://localhost:4200 in your web browser.
Stop and remove the container
$ docker compose downFile: apache-php/README.md
Compose sample application
PHP application with Apache2
Project structure:
.
โโโ compose.yaml
โโโ app
ย ย โโโ Dockerfile
ย ย โโโ index.phpservices:
web:
build: app
ports:
- '80:80'
volumes:
- ./app:/var/www/html/Deploy with docker compose
$ 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 ... doneExpected result
Listing containers must show one container running and the port mapping as below:
$ 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_1After the application starts, navigate to http://localhost:80 in your web browser or run:
$ curl localhost:80
Hello World!Stop and remove the containers
$ docker compose downFile: aspnet-mssql/README.md
Compose sample application: ASP.NET with MS SQL server database
Project structure:
.
โโโ app
โย ย โโโ aspnetapp
โย ย โย ย โโโ appsettings.Development.json
| | โโโ ...
โย ย โโโ ...
โย ย โโโ Dockerfile
โโโ compose.yamlservices:
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 betweenAMD64andARM64architecture, 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
$ 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 ... doneExpected result
Listing containers must show two containers running and the port mapping as below:
$ 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_1After the application starts, navigate to http://localhost:80 in your web browser.
Stop and remove the containers
$ docker compose downFile: django/README.md
Compose sample application
Django application in dev mode
Project structure:
.
โโโ compose.yaml
โโโ app
ย ย โโโ Dockerfile
ย ย โโโ requirements.txt
ย ย โโโ manage.pyservices:
web:
build: app
ports:
- '8000:8000'Deploy with docker compose
$ 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 ... doneExpected result
Listing containers must show one container running and the port mapping as below:
$ 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_1After the application starts, navigate to http://localhost:8000 in your web browser:
Stop and remove the containers
$ docker compose downFile: elasticsearch-logstash-kibana/README.md
Compose sample application
Elasticsearch, Logstash, and Kibana (ELK) in single-node
Project structure:
.
โโโ compose.yamlservices:
elasticsearch:
image: elasticsearch:7.8.0
...
logstash:
image: logstash:7.8.0
...
kibana:
image: kibana:7.8.0
...Deploy with docker compose
$ docker compose up -d
Creating network "elasticsearch-logstash-kibana_elastic" with driver "bridge"
Creating es ... done
Creating log ... done
Creating kib ... doneExpected result
Listing containers must show three containers running and the port mapping as below:
$ 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 esAfter the application starts, navigate to below links in your web browser:
- Elasticsearch:
http://localhost:9200 - Logstash:
http://localhost:9600 - Kibana:
http://localhost:5601/api/status
Stop and remove the containers
$ docker compose downAttribution
The example Nginx logs are copied from here.
File: fastapi/README.md
Compose sample application
Python/FastAPI application
Project structure:
โโโ compose.yaml
โโโ Dockerfile
โโโ requirements.txt
โโโ app
ย ย โโโ main.py
ย ย โโโ __init__.pyservices:
api:
build: .
container_name: fastapi-application
environment:
PORT: 8000
ports:
- '8000:8000'
restart: "no"Deploy with docker compose
docker-compose up -d --buildExpected result
Listing containers must show one container running and the port mapping as below:
$ 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-applicationAfter the application starts, navigate to http://localhost:8000 in your web browser and you should see the following json response:
{
"message": "OK"
}Stop and remove the containers
$ docker compose downFile: flask/README.md
Compose sample application
Python/Flask application
Project structure:
.
โโโ compose.yaml
โโโ app
ย ย โโโ Dockerfile
ย ย โโโ requirements.txt
ย ย โโโ app.pyservices:
web:
build:
context: app
target: builder
ports:
- '8000:8000'Deploy with docker compose
$ 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 StartedExpected result
Listing containers must show one container running and the port mapping as below:
$ docker compose ps
NAME COMMAND SERVICE STATUS PORTS
flask-web-1 "python3 app.py" web running 0.0.0.0:8000->8000/tcpAfter the application starts, navigate to http://localhost:8000 in your web browser or run:
$ curl localhost:8000
Hello World!Stop and remove the containers
$ docker compose downFile: flask-redis/README.md
Compose sample application
Python/Flask application using a Redis database
Project structure:
.
โโโ Dockerfile
โโโ README.md
โโโ app.py
โโโ compose.yaml
โโโ requirements.txtservices:
redis:
image: redislabs/redismod
ports:
- '6379:6379'
web:
build: .
ports:
- "8000:8000"
volumes:
- .:/code
depends_on:
- redisDeploy with docker compose
$ 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 StartedExpected result
Listing containers must show one container running and the port mapping as below:
$ 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/tcpAfter the application starts, navigate to http://localhost:8000 in your web browser or run:
$ 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.
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
$ docker compose down2. 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:
- CONTRIBUTING.md - Contribution workflow and setup
- STYLE.md - Writing style and content guidelines
- COMPONENTS.md - Component and shortcode usage
Copyright and license
Copyright 2013-2026 Docker, Inc., released under the Apache 2.0 license.