Access container from outside (without port mapping)
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.*
I have found a few similar questions but cant find a working solution for me.
Thanks for helping me!
2 Solutions collect form web for “Access container from outside (without port mapping)”
On the docker host, after the container started with option
-itd, for example:
docker run -itd --name=mycon imageName bash, you can use:
docker exec -it mycon[or container_id] bash to enter the container.
Just to close this. I did it like this: https://groups.google.com/d/msg/docker-dev/haJKhzTi48s/jr2e38-PBQAJ
On this Link someone say that you have to give the ethernet port on your VM another IP.
And run your Docker Container like this:
docker run -i -t --rm -p yourip:22:22 docker/image:tag
22 is the Port your service is using.
For more detailed explanation got to the link!
Thanks for your help.