How to make traefik container starts first

Hi,

I try to manage a problem when i need to restart my server.
At the beginning, I haven't specified an ip address (neither a network range ip) for my services and sometimes at restart, traefik doesn't starts first and the containers doesn't starts properly.
To resolve this i just add a static IP to all my container behind traefik network (and add a static ip to traefik too). It's working !

But it's a pain to know what is the next ip available. I have 60 containers and need to add a lots more.

Do you have some bests pratices ?

I'd love not to have to specify an address.

THX

Best practice is to attach Traefik and target services to a Docker network. The Docker daemon will manage the IPs for the containers within the Docker network. Only Traefik needs an external IP and open ports. See simple Traefik example.

Hi @bluepuma77

This is already what i did and this doesn't works. Sometimes traefik container loads after another one in the same Docker network. I need something that guarantees traefik container is loaded first.

Why do you need Traefik loded first? I don’t think Docker can do a preferred load. Maybe you can run Traefik outside of Docker?