Plesk

Is there a way to bind a docker container to localhost only?

Question

Is there a way to bind a docker container to localhost only?

Answer

It may be set by the container settings, with docker command line tool.

For example, to create a Mysql container with specific port 3310 on localhost, a command line like this one should be used:

# docker run --name=mymysql -e MYSQL_ROOT_PASSWORD=password -p 127.0.0.1:3310:3306 mysql