How does the host host access the docker service in the virtual machine?

王林
Release: 2020-05-20 09:52:11
Original
4876 people have browsed it

How does the host host access the docker service in the virtual machine?

System environment:

Host system: windows 8

Virtual machine software: Oracle VirtualBox (CentOS7)

docker version : 19.03.7

Problem description

1. Systemctl start docker inside the virtual machine starts docker

2. docker run -d -p 80:80 nginx starts nginx service

3. Virtual machine ip 192.168.56.200, docker service ip 172.17.0.16

4. Host browser localhost:81 cannot access nginx

The solution is as follows:

1. Open virtualbox

2. Select the virtual machine where the docker service is located

3. Click Settings-> Network

4. Select the NAT network card

5. Click Advanced-> Port Forwarding

How does the host host access the docker service in the virtual machine?

6. Add rules: tcp protocol, host and subsystem port settings, such as host:80 guest:80

How does the host host access the docker service in the virtual machine?

7. Visit localhost:80 with the browser and you can view the nginx interface

How does the host host access the docker service in the virtual machine?

##Recommended tutorial:

docker Tutorial

The above is the detailed content of How does the host host access the docker service in the virtual machine?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!