The following is a Docker Compose script for setting up MySQL with NGINX Proxy Manager running in another container on the same host:
version: '3.8'
services:
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: your_root_password
MYSQL_DATABASE: your_database_name
MYSQL_USER: your_username
MYSQL_PASSWORD: your_password
Manager
hostname: mysqldb #Change this your preferred hostname for the container
volumes:
- mysql_data:/var/lib/mysql
networks:
- nginxpm_default
volumes:
mysql_data:
networks:
nginxpm_default:
external: true
This is a simpler version that does not use NPM the ports are exposed on the host:
version: '3.8'
services:
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: your_root_password
MYSQL_DATABASE: your_database_name
MYSQL_USER: your_username
MYSQL_PASSWORD: your_password
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
volumes:
mysql_data:

Leave a comment