Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why docker uses port numbers from 32768-65535?

Being new to Docker, I have a basic question on why Docker uses the port numbers ranging from 32768 to 65535 ?

Why is that particular range selection ? Are other ports not useful ?

Can someone help me in understanding this better..

like image 393
Here_2_learn Avatar asked Nov 24 '16 13:11

Here_2_learn


People also ask

Why port number is 65535?

The highest TCP port number is 65,535. The TCP protocol provides 16 bits for the port number, and this is interpreted as an unsigned integer; all values are valid, apart from 0, and so the largest port number is (2^16 - 1) or 65,535.

What is the port range for Docker?

The default ephemeral port range from 49153 through 65535 is always used for Docker versions before 1.6.

How do ports work in Docker?

Port mapping is used to access the services running inside a Docker container. We open a host port to give us access to a corresponding open port inside the Docker container. Then all the requests that are made to the host port can be redirected into the Docker container.

What do the ports mean Docker?

Ports is defined as: Either specify both ports (HOST:CONTAINER), or just the container port (a random host port will be chosen). Ports mentioned in docker-compose. yml will be shared among different services started by the docker-compose. Ports will be exposed to the host machine to a random port or a given port.


2 Answers

Short answer: These ports were once defined for being not to be reserved for some special use like 80 or 443.

Long anwser: Best TCP port number range for internal applications

like image 168
actc Avatar answered Sep 18 '22 18:09

actc


The port numbers in the range from 0 to 1023 are the system ports. These are used for standard, well-known network services. They are also restricted, so only the super user is able to bind to one of these.

Next ranges of ports, especially under 10000, are still usually a standard ports of some services, but they are not restricted. Some common examples are 8080 (HTTP alternative), 8443 (HTTPS alternative) or 1099 (Java RMI registry). See this for more examples.

Range of 32768 to 65535 is quite safe to just get a random one and use, because they are not used widely.

like image 39
Michał Kalinowski Avatar answered Sep 20 '22 18:09

Michał Kalinowski