Answer the question
In order to leave comments, you need to log in
How to set up networking in docker on Mac OS X?
There is a home network 192.168.0.1/24 .
There is Ubuntu running in Docker Quickstart Terminal docker run -v /Users:/Users -i -t ubuntu /bin/bash
and the only available network adapter is eth0 on the network 172.17.0.1/16 (terminal on the left)
And there is a default running virtual machine created in VirtualBox by docker (terminal on the right). The output of ifconfig differs significantly from Ubuntu
. At the same time, in the network settings of VM default networks, you can see 3 adapters .
I don’t quite understand why VM default and running Ubuntu are two different virtual machines ...
, which currently has the only 172.17.0.2 (the nginx server is running there)?
ifconfig output in Mac OS X El Capitan pastebin.com/R7TfiWrb
Answer the question
In order to leave comments, you need to log in
In the VirtualBox settings of the docker virtual machine, you need to configure one of the interfaces as a network bridge on en0 in Mac OS X. For some reason, the second and third adapters are the same for you, the third one is not forwarded at the moment and can be changed to a network bridge.
Now ifconfig on the virtual machine will look like this:
Next, when starting the container, make port forwarding from the container to the virtual machine on the network interface of the bridge. Parameter "-p portvirtmachine:portcontainer"
For example:
docker run --name nginx -p 8080:80 -d richarvey/nginx-php-fpm
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question