version: '3.8' services: #MongoDB (27017) mongodb: image: "mongo:latest" container_name: mongoDB volumes: - ./mongo/:/data/db networks: - backend ports: - "27017:27017" depends_on: - traefik environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: rootpassword restart: unless-stopped #MySQL (3306) + phpMyAdmin () mysql: image: "mysql" container_name: MySQL volumes: - ./mysql/:/var/lib/mysql networks: - backend ports: - "3306:3306" depends_on: - traefik environment: MYSQL_ROOT_PASSWORD: rootpassword MYSQL_DATABASE: test_db restart: unless-stopped phpMyAdmin: image: "phpmyadmin/phpmyadmin:latest" container_name: phpMyAdmin networks: - backend depends_on: - mysql - traefik environment: PMA_HOST: mysql labels: ## Expose phpMyAdmin Through Trefik ## - "traefik.enable=true" # <== Enable traefik to proxy this container - "traefik.http.routers.phpMyAdmin.rule=Host(`mysql.luke-else.co.uk`) || Host(`www.mysql.luke-else.co.uk`)" - "traefik.http.routers.phpMyAdmin.entrypoints=http" - "traefik.http.routers.phpMyAdmin.middlewares=redirect@file" - "traefik.http.routers.phpMyAdmin-secured.rule=Host(`mysql.luke-else.co.uk`) || Host(`www.mysql.luke-else.co.uk`)" - "traefik.http.routers.phpMyAdmin-secured.entrypoints=https" - "traefik.http.routers.phpMyAdmin-secured.tls.certresolver=mytlschallenge" restart: unless-stopped networks: backend: external: true