Perfect solution to the problem of not being able to access the port of the docker container under Windows 10

Perfect solution to the problem of not being able to access the port of the docker container under Windows 10

Solve the problem of not being able to access the port of the docker container under Windows 10 (port mapping problem)

Installed docker and docker-compose on Windows 10 server

And try to run the Nginx service in it, and the mapping is also done

Problem: In the host's browser, opening localhost:port cannot access the corresponding Web service.

Problem Analysis

Reason: Docker runs on Linux. To run Docker in Windows, you actually need to first install a Linux environment under Windows and then run Docker in this system.

That is to say, the localhost used in the service refers to the address of this Linux environment, not our host environment Windows 10.

Solution

Start the Docker command line window

Enter the command

docker-machine ip default

Linux IP address, usually this address is 192.168.99.100

Then in the Windows browser, enter http://IP:port to enable it (http://192.168.99.100:8069)

Supplementary knowledge: Nacos 1.2.1 Nacos local deployment service, modifying the default port is invalid, Docker deployment does not have this problem

1. Scenario Description

In the normal project development process, especially in the production environment deployment, we will try to avoid using sensitive ports. During this test, the default port 8848 of the server started by Nacos-server-1.2.1 startup.bat was changed to 8858, and Nacos could be accessed and logged in normally.

However, when the project is started, the resource service of pulling 8848 is still obtained. Currently, this problem exists in nacos-server-1.2.1 and nacos-server-1.3.2. After testing, the Nacos service deployed via Docker does not have this problem after changing the default port.

2. Configuration steps

Modify the port configuration of application.properties under conf in the nacos-server-1.2.1 folder to 8858

Start nacos-server-1.2.1 with startup.cmd

Check whether the Nacos service is accessible normally

Modify the address and port of the access discovery and configuration center in the project

Start a Project

3. Solution

ISSUE has been raised, you can follow the progress in time

Deploy Nacos server using Docker

Use the default port and do not modify the port

The above article perfectly solves the problem of being unable to access the port of the docker container under Windows 10. This is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Solution for multiple Docker containers not having the same port number
  • How to modify the port mapping of a running Docker container
  • How to dynamically modify container port mapping in Docker
  • Docker connects to a container through a port
  • Docker dynamically exposes ports to containers
  • Solution to the Docker container being unable to access the host port
  • Docker implements container port binding local port

<<:  How to implement responsiveness in Vue source code learning

>>:  Things to note when writing self-closing XHTML tags

Recommend

Use of align-content in flex layout line break space

1. The effect diagram implemented in this article...

js method to realize shopping cart calculation

This article example shares the specific code of ...

How to remove the dividing line of a web page table

<br />How to remove the dividing lines of a ...

How to set a fixed IP address for a VMware virtual machine (graphic tutorial)

1. Select Edit → Virtual Network Editor in the me...

Why is it slow when using limit and offset paging scenarios?

Let’s start with a question Five years ago when I...

Problems with installing mysql and mysql.sock under linux

Recently, I encountered many problems when instal...

LINUX Checks whether the port is occupied

I have never been able to figure out whether the ...

Pitfall notes of vuex and pinia in vue3

Table of contents introduce Installation and Usag...

Summary of commonly used multi-table modification statements in Mysql and Oracle

I saw this question in the SQL training question ...

Vue uniapp realizes the segmenter effect

This article shares the specific code of vue unia...

MySQL tutorial data definition language DDL example detailed explanation

Table of contents 1. Introduction to the basic fu...

Use PSSH to batch manage Linux servers

pssh is an open source software implemented in Py...

MySQL 5.7.30 Installation and Upgrade Issues Detailed Tutorial

wedge Because the MySQL version installed on the ...