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

Detailed explanation of Linux tee command usage

The tee command is mainly used to output to stand...

Implementation of iview permission management

Table of contents iview-admin2.0 built-in permiss...

How to Customize Bash Command Prompt in Linux

Preface As we all know, bash (the B ourne-A gain ...

Detailed explanation of the use of custom parameters in MySQL

MySQL variables include system variables and syst...

Vue uses Baidu Maps to realize city positioning

This article shares the specific code of Vue usin...

A brief discussion on the use of React.FC and React.Component

Table of contents 1. React.FC<> 2. class xx...

Mariadb remote login configuration and problem solving

Preface: The installation process will not be des...

CSS float (float, clear) popular explanation and experience sharing

I came into contact with CSS a long time ago, but...

A summary of detailed insights on how to import CSS

The development history of CSS will not be introd...

Parsing Apache Avro Data in One Article

Abstract: This article will demonstrate how to se...

Summary of knowledge points on using calculated properties in Vue

Computed properties Sometimes we put too much log...

A detailed introduction to the basics of Linux scripting

Table of contents 1. Script vim environment 2. Ho...

Dynamically add tables in HTML_PowerNode Java Academy

Without further ado, I will post the code for you...

How to calculate the frame rate FPS of web animations

Table of contents Standards for smooth animation ...