Closed humaintenance closed 1 year ago
What's the use case of running the rebuild-dndc container under the custom network?
@humaintenance hopefully @Lanjelin 's PR has worked for you
Coming back to this 1+ year later, I think the fix in https://github.com/elmerfds/rebuild-dndc/pull/63 resolves the issue on startup, but misses the same fix on subsequent runs. Note that the query here is missing the custom_network
variable.
I do not have permissions to push to the repo, but I've tested this patch on my setup and it seems to work just fine!
diff --git a/Rebuild-DNDC/Rebuild-DNDC.sh b/Rebuild-DNDC/Rebuild-DNDC.sh
index 7d347ad..19f8aea 100644
--- a/Rebuild-DNDC/Rebuild-DNDC.sh
+++ b/Rebuild-DNDC/Rebuild-DNDC.sh
@@ -134,7 +134,12 @@ first_run()
then
printf "A. SKIPPING: FIRST RUN SETUP\n"
was_run=0
- getmastercontendpointid=$(docker inspect $mastercontname --format="{{ .NetworkSettings.EndpointID }}")
+ if [[ -z "$custom_network" || "$custom_network" = "false" ]]
+ then
+ getmastercontendpointid=$(docker inspect $mastercontname --format="{{ .NetworkSettings.EndpointID }}")
+ else
+ getmastercontendpointid=$(docker inspect $mastercontname --format="{{ .NetworkSettings.Networks.${custom_network}.EndpointID }}")
+ fi
currentendpointid=$(<$mastercontepfile_loc/mastercontepid.tmp)
fi
}
Please consider opening a follow up PR to apply this fix.
Edit: I'm new to OSS contribution and didn't realize I could get my own PR stood up. That's up here now: https://github.com/elmerfds/rebuild-dndc/pull/70
I'm trying to utilize a custom docker network, and put the master container and rebuild-dndc inside it, which results in containers not being rebuilt.
I believe I see why, that being when container is in a custom network the endpointID is nested further when inspected, so when running
docker inspect $mastercontname --format="{{ .NetworkSettings.EndpointID }}"
no value is returned. You'd have to instead rundocker inspect $mastercontname --format="{{ .NetworkSettings.Networks.CustomNetworkName.EndpointID }}"
Is there a way that I can achieve what I'm trying to do without forking and changing the script?