Providing a Docker Container Port

I am trying to connect to the docker container via ip, but reamins failed. When I used "docker inspect container-id", I get this result.

Docker container port

My default virtual box settings:

Virtual box settings

Can someone help me solve this problem?

0
source share
2 answers

When launching dockers, you can specify which ports you want to be accessible to the outside world. The basic syntax is:

docker run -p hostPort:containerPort imageName

or simply

docker run -p hostPort imageName

In the first case, the external is used hostPort, but inside the container: containerPortwill be used. In the second case, you will simply use this port both inside and outside your container.

, EXPOSE Docker.

+2

.

:

docker run -p 2022: 22 -p 2375: 2375

:

docker run -p 22 -p 2375

+1

Source: https://habr.com/ru/post/1610469/


All Articles