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?

  • “ No route to host” between two Docker Containers
  • Can Linux Container run on a virtual machine? [closed]
  • Accessing database that is running inside a docker container?
  • Issue getting memcache container to automatically start in Docker
  • container is in waiting state, kubernetes, docker container
  • Cassandra cluster manager (ccm) on docker
  • 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!

  • How to forward hostname based request to a specific docker container
  • Connecting inside container at docker environment using JSCH
  • Error while running Jenkins in Docker
  • How to read and write to mounted volume without running as root?
  • Connection refused in Docker containers communicating through exposed ports
  • Behat Mink file upload not finding file on submit
  • 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:

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.