983 B
983 B
title | description | published | date | tags | editor | dateCreated |
---|---|---|---|---|---|---|
How to use Docker Compose | true | 2023-06-26T13:38:49.025Z | docker, ubuntu, containerization, container, linux, server | markdown | 2023-06-26T13:38:49.025Z |
How to use Docker Compose
Examples for using Docker Compose, specifically tested on Ubuntu 22.04.
Prerequisites
- Docker installed on your system
- A user account with sudo privileges
Examples
Base docker-compose.yml file:
version: "3"
services:
<service_name>:
image: <image>
container_name: <container_name>
restart: <restart-policy>
ports:
- "<host>:<container>"
volumes:
- <host>:<container>
environment:
- <key>=<value>
Nginx docker-compose.yml example:
version: "3"
services:
nginx:
image: nginx:latest
container_name: nginx
restart: always
ports:
- "80:80"
volumes:
- /home/nginx:/var/www/html
environment:
- TZ=Europe/London