Access container from outside (without port mapping)

Hi, I’m using Docker 1.13.1 on my Centos 7.3 virtual machine and run a container based on Centos 6 on it.
My problem is that I want to acccess my container from outside of the virtual machine but without port mapping!

Is there a way to access my container via IP or hostname?
Maybe I could give my container a IP from my DHCP like my virtual machine (10.10…) gets one?

At the moment my container is using the default docker bridge (docker0) where he gets a IP like 172.17.0.*

Thanks for helping me!:slight_smile:

Hello,

It looks like you want to use macvlan driver :

And with macvlan it is possible to access my container from the physical host?

Physical host: 10.10.28.*
Virtual machine Centos 7.3: 10.10.65.*
Docker container: something like 10.10.66.*

Yes I think so since this driver allows you to expose the internal IP to the vlan.
I’ve never tried it myself but that’s what I understand from the docs.

Ok, thanks!

I will try it again with macvlan and give you some feedback if i could solve my problem.

But the problem is that i have tried so many things but nothing worked like i want it to work.

  • With port mapping it worked very nice but in this case i can just access my container from outside with like: host-ip:port

  • With pipework (https://github.com/jpetazzo/pipework) i was able to get a IP from my DHCP Server. Pinging from docker host to container and back worked well but from outside i had no chance.

Is there anyone else who can help me?

Did you ever get this working with MACvLAN? I’m finding I’m unable to have host <-> container communication, or continer <->host<->host<->container communication either.

I can get containers on the same MACvLAN to ping, and also DNS, but that’s about it. I need my continers to be about to talk to the outside world. Also, mapping ports in the run command doesn’t seem to help.

Pls check if this helps(https://sreeninet.wordpress.com/2016/05/29/docker-macvlan-and-ipvlan-network-plugins/). Host cannot directly talk to container in macvlan network unless macvlan interface is created on host as well.

No I’m not … currently I use the normal portmapping!!