Converting docker run to docker compose

I want to convert my docker run command, but I cannot get it working. This is the docker run command I use and works well

sudo docker run -d 
  -v /var/run/docker.sock:/var/run/docker.sock 
  -v $PWD/traefik.toml:/traefik.toml 
  -v $PWD/acme.json:/acme.json 
  -p 80:80 
  -p 443:443 
  -l traefik.frontend.rule=Host:monitor.localhost 
  -l traefik.port=8080 
  --network traefik-proxy 
  --name traefik 
  traefik --docker

And this is the compose file I built:

version: "3"
services:
  traefik:
    image: traefik
    container_name: traefik-2
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./traefik.toml:/traefik.toml
      - ./acme.json:/acme.json
    labels:
      traefik.frontend.rule: "Host:monitor.localhost"
      traefik.port: "8080"
networks:
  default:
    external:
      name: traefik-proxy

The problem is that when I use docker-compose, the proxy seems to be working, but when I access the monitor site (monitor.localhost), it gives me a 404 not found. I have double checked everything, but I just can’t figure it out what is wrong with the compose file. I tried to get into the shell of the container to see if it looks alright, but apparently Alpine based Traefik image doesn’t have bash, or even sh.

Source: StackOverflow