Docker Community Forums

Share and learn in the Docker community.

How to access docker container from another machine on local network

@astralix, because of the design of Docker, I think what you’re trying to do is quite difficult.

Now, I’m a noob so could be way off here, but it seems to me that Docker handles application sets… It doesn’t virtualise the OS or any of ‘that layer’, which is partly why you’re struggling to assign a unique IP to a container. I’m imagine there’s some brave methods of hackery via assigning multiple IPs to the host and attempting to ‘present’ the additional addresses to a given container, but it looks like an uphill battle to me.

I have however, stumbled across a particularly complicated guide with IPTables and whanot using macvlan networks here, but honestly, after skimming through, I couldn’t follow it. It’s definitely what you’re after, as the documentation talks about assigning a MAC to the container…

However, once I understood the container shares the same IP as the host, I got over it and enjoyed not banging my head against the wall.

  • Personally, I think you’d be better of moving ‘down the stack’ and exploring ESXi, Hyper-V, Xen etc, or digging into the macvlan thing.

Can you explain a way to do the same on linux?