Skip to content

Instantly share code, notes, and snippets.

@zaxo7
Last active April 11, 2022 18:07
Show Gist options
  • Save zaxo7/4056ad4a6d57857db24c839b710616a9 to your computer and use it in GitHub Desktop.
Save zaxo7/4056ad4a6d57857db24c839b710616a9 to your computer and use it in GitHub Desktop.
Share docker container over the network

computer A (who has docker container running) : 192.168.1.73

computer B (the one who i want to access docker from) : 192.168.1.53

Docker network : 172.17.0.0/16

Docker container : 172.17.0.2

  • On computer A route traffic going to 172.17.0.0/16 over 192.168.1.73

ip route add 172.17.0.0/16 via 192.168.1.73

  • On computer B

iptables -I FORWARD -s 192.168.1.56 -j ACCEPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment