Prefix container hostname with the underlying one

To make it easier to identity where a docker container is running,
prefix its hostname with the underlying one from the host.

Docker chooses a 12 character random hex string by default, so we'll
keep that as the suffix.
This commit is contained in:
Donal McBreen
2023-05-31 16:17:15 +01:00
parent de2de19434
commit 28d6a131a9
4 changed files with 25 additions and 6 deletions

View File

@@ -29,7 +29,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
execute *auditor.record("Booted app version #{version}"), verbosity: :debug
old_version = capture_with_info(*app.current_running_version, raise_on_non_zero_exit: false).strip
execute *app.start_or_run
execute *app.start_or_run(hostname: "#{host}-#{SecureRandom.hex(6)}")
Mrsk::Utils::HealthcheckPoller.wait_for_healthy(pause_after_ready: true) { capture_with_info(*app.status(version: version)) }