I have an example project here, that when run using port 80 works as expected. When I change apache's and traefik's port to 8888. Traefik gives me a 'bad gateway' error and logs:
502 Bad Gateway' caused by: dial tcp 192.168.64.3:80: connect: connection refused"
Can anyone have a look to see if they can replicate this/provide me with a solution? My intention is to run apache on non- privileged ports.
Here are the files:
Dockerfile:
FROM php:7.3-apache-stretch
RUN touch /var/www/html/index.html
RUN sed -ri "s!Listen 80!Listen 8888!" /etc/apache2/ports.conf
RUN sed -ri "s!<VirtualHost *:80>!<VirtualHost *:8888>!" /etc/apache2/sites-available/000-default.conf
CMD ["apache2-foreground"]
docker-compose.yml:
version: '3.7'
services:
traefik:
restart: always
image: traefik:v2.0.0-rc1
ports:
- 8888:8888
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
--entrypoints.web.address=:8888
--providers.docker=true
--log.level=DEBUG
apache:
build:
context: .
restart: "no"
labels:
- traefik.http.routers.router1.entrypoints=web
- traefik.http.routers.router1.rule=Host(
`localhost`)
depends_on:
- traefik