Customizable Traefik host port

Allow users to free up port 80 on the host machine, without losing
Traefik's Docker routing super-powers.
This commit is contained in:
Chris Lowder
2023-03-04 21:41:08 +00:00
parent 8c69990dbb
commit 963b96ff62
3 changed files with 19 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
"--detach",
"--restart", "unless-stopped",
"--log-opt", "max-size=#{MAX_LOG_SIZE}",
"--publish", "80:80",
"--publish", port,
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
"traefik",
"--providers.docker",
@@ -45,6 +45,10 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
docker :image, :prune, "--all", "--force", "--filter", "label=org.opencontainers.image.title=Traefik"
end
def port
"#{config.raw_config.traefik.fetch("host_port", "80")}:80"
end
private
def cmd_args
(config.raw_config.dig(:traefik, "args") || { }).collect { |(key, value)| [ "--#{key}", value ] }.flatten