We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0d9b164 + 5fb2258 commit 89cfb5fCopy full SHA for 89cfb5f
1 file changed
infra/image/shcontainer
@@ -55,6 +55,17 @@ container_start() {
55
56
log info "= Starting ${name} ="
57
podman start "${name}"
58
+ # Add host entry to /etc/hosts
59
+ ip=$(podman inspect "${name}" --format "{{.NetworkSettings.IPAddress}}")
60
+ hostname=$(podman inspect "${name}" --format "{{.Config.Hostname}}")
61
+ if [ -n "${ip}" ] && [ -n "${hostname}" ]; then
62
+ cmd=$(cat <<EOF
63
+sed -i -e "/[ \t]${hostname}/d" /etc/hosts
64
+echo -e "$ip\t${hostname} ${hostname%%.*}" >> /etc/hosts
65
+EOF
66
+ )
67
+ podman exec "${name}" bash -c "$cmd"
68
+ fi
69
# Ensure /etc/shadow is readable
70
podman exec "${name}" bash -c "chmod u+r /etc/shadow"
71
echo
0 commit comments