version: "3"
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
# In this case, the Docker socket file located at /var/run/docker.sock on the host machine is mapped to /tmp/docker.sock inside the container with read-only (ro) permissions. This allows the reverse proxy server inside the container to dynamically discover and proxy requests to other Docker containers running on the same host machine. This is because the Docker socket file provides an API for managing and inspecting running Docker containers, and the jwilder/nginx-proxy image is configured to automatically discover and proxy requests to any containers that have a VIRTUAL_HOST environment variable defined.
- /var/run/docker.sock:/tmp/docker.sock:ro
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: ${USER}
WORDPRESS_DB_PASSWORD: ${ROOT_PASSWORD}
WORDPRESS_DB_NAME: ${DATABASE}
VIRTUAL_HOST: dev.majn.local
volumes:
- ./wp-content:/var/www/html/wp-content
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${ROOT_PASSWORD}
MYSQL_DATABASE: ${DATABASE}
MYSQL_USER: ${USER}
MYSQL_PASSWORD: ${ROOT_PASSWORD}
phpmyadmin:
depends_on:
- db
image: phpmyadmin
restart: always
ports:
- 1337:80
environment:
- PMA_ARBITRARY=1
volumes:
db_data:
Dockerfile for WP+DB+PMA (aka this blog) w/ NGINX Reverse Proxy
Tags: