Skip to content

Instantly share code, notes, and snippets.

@samialdury
Last active February 21, 2024 11:15
Show Gist options
  • Save samialdury/ff347d8cd3d17a365da708ca01a936b8 to your computer and use it in GitHub Desktop.
Save samialdury/ff347d8cd3d17a365da708ca01a936b8 to your computer and use it in GitHub Desktop.

Common docker compose setups

services:
mysql_dev:
image: mysql:8
container_name: mysql
restart: unless-stopped
healthcheck:
test:
- CMD
- mysqladmin
- ping
- -u
- root
- -p$$MYSQL_ROOT_PASSWORD
start_period: 10s
interval: 3s
timeout: 1s
retries: 5
env_file:
- .dev.env
ports:
- 3306:3306
volumes:
- mysql_data:/var/lib/mysql
profiles:
- support
volumes:
mysql_data:
services:
nginx:
image: nginx:1-alpine
container_name: nginx
restart: unless-stopped
network_mode: host
volumes:
- ./templates:/etc/nginx/templates
- nginx_data:/etc/nginx
volumes:
nginx_data:
services:
portainer_agent:
image: portainer/agent:2.19.1-alpine
container_name: portainer_agent
restart: always
ports:
- 9001:9001
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
services:
portainer:
image: portainer/portainer-ce:2.19.1-alpine
command: --http-enabled
container_name: portainer
restart: always
ports:
- 8000:8000
- 80:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
volumes:
portainer_data:
services:
postgres:
image: postgres:15-alpine
container_name: postgres
restart: unless-stopped
healthcheck:
test:
- CMD
- pg_isready
start_period: 10s
interval: 3s
timeout: 1s
retries: 5
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
postgres_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment