Docker
MySQL
This page is the reminder notes for me if someone setup the docker container of MySQL not correctly, you can't block it in multiple offical way in some reason, like if it is not done and follow by you, and it accident roar for it, there is bunch of sh*t already turns on and running, you don't have time to check it one by one but you need to block it or else the mySQL port will be publiclly accessable problem in the network restricted envoriment, then this guide will save your life.
Normal I would recommend you to do it in offically way by creating a network rules first before eveything, making rules is very important as if there are bunch of containers, you won't want to amended their network setting one by one if they are sharing some same network rules.
By doing so, first create a network allow to access the internet but expose the ports internally:
Adding this IPTable rules would be recommend also:
Then create a rule which will block the internet access:
After that, you can block the container internet access or allow it by rules, for example, to block one of the container's internet accessing:
You may want to check out docker network for details as it is crazily useful and important when you setup the docker.
For more docker network related information:
https://docs.docker.com/network/
But sometimes there is one of them having problem, and you have tons of reason need to solve it immediantly, then you can do the below step some blocking the specific port.
Matching the container ID by first 12 char with the folder
Amened the Host IP as
Then save the file and quit