I deployed portainer with the following docker-compose.yml:
command: -H unix:///var/run/docker.sock
It has worked fine along with my other services fronted by Traefik.
After my server rebooted I now get a 502 bad gateway at portainer.mydomain.ca
The container is running, it is attached to the 'web' network, and its logs show it is listening on :9000.
In Traefik's web interface, the frontends and backends are listed, backed has the correct container ip address and port.
Anyone clue me in as to why this would stop working?
Hi @VinistoisR, can you switch from
expose on the docker-compose file of your portainer?
Using the directive ports means that Docker will publish the port to the outside network, which you don't want. If you use expose, Traefik will still be able to pick the ports and IP, and every requests "Traefik <-> Portainer" will stay inside the Docker private network named
Not 100% sure if it will solve your issue, as it could be tons of others causes.
If the error
502 persists, can you do the following:
- Reports here the full configuration for both Traefik and Portainer
- Reports here the result of the commands
docker inspect <Container ID> for both containers traefik and portainers, so we can check if Docker messed up anything during the reboot?
- Try to create a container attached to the
web network, and run a verbose
curl request to portainer?
$ docker run --rm -ti --network=web alpine:3.10 sh
#/ apk add --no-cache curl # Install curl
#/ curl --verbose --location --silent http://<IP of portainer container>:9000/