I’m working on this. First, I will simple do an add and a remove of the iptables rule. Something like this to add the rule:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports ${PORTAL_LISTENING_PORT}
And simply the following to remove it:
iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports ${PORTAL_LISTENING_PORT}
Then I will learn about trying to trap the container exit and cleanup that way.
Meanwhile, I can’t get a console on the wifi-connect container:
$ balena ssh c9c0792 wifi-connect
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown
Shared connection to ssh.balena-devices.com closed.
Does that indicate that this container has no shell present? I’d like to be able to debug this…
Any thoughts?