mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +02:00
Use more generic expression to fetch container IP addresses.
The IP address has been moved in newer versions of Docker but this expression will fetch the IP address from the old or new location.
This commit is contained in:
@@ -67,7 +67,10 @@ sub new
|
||||
{bSuppressStdErr => true});
|
||||
|
||||
# Get IP Address
|
||||
$self->{strIP} = trim(executeTest("docker inspect --format '\{\{ .NetworkSettings.IPAddress \}\}' $self->{strContainer}"));
|
||||
$self->{strIP} = trim(
|
||||
executeTest(
|
||||
"docker inspect --format '\{\{range .NetworkSettings.Networks\}\}\{\{.IPAddress\}\}\{\{end\}\}'" .
|
||||
" $self->{strContainer}"));
|
||||
$self->{bActive} = true;
|
||||
|
||||
# Return from function and log return values if any
|
||||
|
||||
@@ -187,7 +187,10 @@ hrnHostNew(const StringId id, const String *const container, const String *const
|
||||
|
||||
// Get IP address
|
||||
const String *const ip = strTrim(
|
||||
execOneP(strNewFmt("docker inspect --format '{{ .NetworkSettings.IPAddress }}' %s", strZ(hrnHostContainer(this)))));
|
||||
execOneP(
|
||||
strNewFmt(
|
||||
"docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' %s",
|
||||
strZ(hrnHostContainer(this)))));
|
||||
|
||||
MEM_CONTEXT_PRIOR_BEGIN()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user