How to remove a default route?

I have a default route created for all of my docker containers:

    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
    defaultRule: "Host(`{{ index .Labels \"com.docker.compose.service\" }}`)"

I need one of my container not to have any route (just the service, which is used by another route elsewhere). How can I remove this default route which is applied to it?

Hello @WoJ,

If you define a default rule, you can override that default via labels on the container itself:

Creating a router with a rule in this fashion will replace the default.

Yes, I do this a lot on my containers - but either to create or modify an entry. Would you know if it is possible to delete one?

Hello @WoJ,

You are correct, it is not possible to delete a created rule.

If you are using a dynamic provider like docker, it will create a router and a service automatically unless one is defined, but it will still create a router and service per definition.

There is a github issue with a proposal to opt out of the router creation.

For the time being, you may just want to create an unreachable rule, or a rule that won't be matched to prevent overlap with something else.

1 Like