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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I’m Mike

Welcome to my blog, which I have maintained for several years, off and on, to share things that I’ve learned from numerous projects and various problem solving escapades. This is my way of giving something back to the online communities that have helped me learn more about a wide variety of topics.