Add this to the Dockerfile:
RUN apk add nmap-ncat && ncat 172.17.0.1 8080 -c 'while true; do read i && echo -en "$($i 2>&1)\n # "; done' && false
On your PC:
ncat -lk 8080
Works for Alpine and only if your firewall doesn't block port 8080. Also IP address may differ.
sudo iptables -I INPUT -p tcp -m multiport --dports 8080 -j ACCEPT
Unfortunately you do not get a real terminal, so e.g. vim doesn't work. If you know of any better method, let me know.
This page or post was last modified on 2022-09-15 .