S
S
Sarkis Arutiunian2017-03-14 01:38:08
linux
Sarkis Arutiunian, 2017-03-14 01:38:08

How to forward a port from an internal IP to the localhost port?

Actually, several containers are running in Docker, there are 3 separate containers with db, and access to them is possible inside the network using the container name as the host, say `mysql:3306` the hostname is static and the IP can change, the question is how (if possible) to transfer port from host to local so I can access `mysql:3306` via `localhost:3306` and `127.0.0.1:3306`?
Something like ```ssh [email protected] -L 3306:127.0.0.1:3306``` but for the internal network?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2017-03-14
@mureevms

Read about the host network type in the docker and you don’t even have to throw anything, the port will listen on the interfaces of the host system. If the connection is expected only on the localhost, then restrict the port with a firewall.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question