Skip to content

Instantly share code, notes, and snippets.

@antonioanerao
Created June 8, 2024 11:25
Show Gist options
  • Save antonioanerao/f62d815ccd3b29732c284f74bd2ad705 to your computer and use it in GitHub Desktop.
Save antonioanerao/f62d815ccd3b29732c284f74bd2ad705 to your computer and use it in GitHub Desktop.
Docker compose WordPress
services:
traefik:
image: "traefik"
container_name: "traefik"
restart: always
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- proxy
wordpress:
container_name: wordpress
image: wordpress
restart: always
networks:
- proxy
environment:
WORDPRESS_DB_HOST: wordpress
WORDPRESS_DB_USER: user
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: dbname
volumes:
- ./wordpress:/var/www/html
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.wordpress.rule=Host(`wordpress.docker.localhost`)"
- "traefik.http.routers.wordpress.entrypoints=web"
mysql:
image: ubuntu/mysql:latest
container_name: mysql
restart: always
networks:
- proxy
ports:
- 3306:3306
- 33060:33060
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_RANDOM_ROOT_PASSWORD: '1'
cap_add:
- SYS_NICE
volumes:
- ./database:/var/lib/mysql
phpmyadmin:
image: phpmyadmin
container_name: "phpmyadmin"
restart: always
networks:
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.phpmyadmin.rule=Host(`phpmyadmin.docker.localhost`)"
- "traefik.http.routers.phpmyadmin.entrypoints=web"
environment:
- PMA_ARBITRARY=1
networks:
proxy:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment