docker (running in virtual box) expose port on host machine

I’m running docker in virtual box (docker machine) on a MAC server. I have some running containers that expose certain ports to the host machine, so I can access them via URL of the virtual machine + exposed port. But I’m not able to reach the exposed services from outside the host system, as the docker containers are sandboxed in their own virtual network I guess.

Is it possible to also expose the port on the host machine so people from outside can reach the web services running in docker inside my virtual machine?

  • External endpoint of Kubernetes dashboard
  • How to create docker image for local application taking file and value parameters
  • Deployment of multiple instances of Tomcat in single Dockerfile using Supervisor
  • Docker: how to build an image from a non-master branch on Github repository
  • Run Java command line from node.js dokku container
  • docker nginx and php, php cant connect to localhost
  • Sending SIGTERM to all processes
  • Fail to connect mysql in running wordpress docker
  • What's the best way to debug a NodeJs app running on a docker container in a remote host?
  • Why am i forced to run docker with sudo on OS X?
  • Integrate Grunt in docker-compose?
  • Run Docker PHP-apache: Forbidden You don't have permission to access / on this server
  • One Solution collect form web for “docker (running in virtual box) expose port on host machine”

    There are 2 options:

    • Selecting Bridged Networking: in bridged mode, the virtual machine will appear as a separate device on your network and have its own IP address.
    • Port forwarding (NAT): This is only necessary when you don’t want to use the Bridge apdater

    I hope this guide can help you.

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