I'm fairly new to Docker and Traefik. My initial aim is simply to get WordPress running on my local machine (Mac running Docker Desktop).
All containers start up, and I can see and navigate the dashboard at 127.0.0.1:8080
, but visiting 127.0.0.1
gives "404 page not found".
I'm a bit unclear as to whether I need to update my hosts file. I did try that, but it made no difference.
I'm not concerned about SSL/TLS at this point - just trying to crawl before I walk. Here's my docker-compose.yml. Any insights appreciated!
version: '3'
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.2
# Enables the web UI and tells Traefik to listen to docker
command: --api.insecure=true --providers.docker
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik
my_db_service:
image: 'bitnami/mariadb:10.3'
container_name: my_db_container
restart: unless-stopped
env_file: .env
environment:
- MARIADB_ROOT_PASSWORD=$my_DB_ROOT_PASSWORD
- MARIADB_PASSWORD=$my_DB_PASSWORD
- MARIADB_USER=$my_DB_USER
- MARIADB_DATABASE=$my_DB
- ALLOW_EMPTY_PASSWORD=no
ports:
- 3306:3306
volumes:
- './my_data:/bitnami/mariadb'
networks:
- traefik
my_wp_service:
image: wordpress:5.4.2-php7.2-fpm-alpine
labels:
- "traefik.enable=true"
- "traefik.http.routers.my_wp_container.entrypoints=http"
- "traefik.http.routers.my_wp_container.rule=Host(`my_wp_container.my.local`, `www.my_wp_container.my.local`)"
- "traefik.http.services.my_wp_container.loadbalancer.server.port=80"
- "traefik.docker.network=traefik"
depends_on:
- my_db_service
container_name: my_wp_container
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=my_db_service:3306
- WORDPRESS_DB_USER=$my_DB_USER
- WORDPRESS_DB_PASSWORD=$my_DB_PASSWORD
- WORDPRESS_DB_NAME=$my_DB
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./my_site:/var/www/html
networks:
traefik:
external: true