In Ubuntu:
First you need to check if the Docker database port is accessible on your system using the following command -
sudo iptables -L -n
OUTPUT Sample:
Chain DOCKER (1 references) target prot opt source destination ACCEPT tcp -- 0.0.0.0/0 172.17.0.2 tcp dpt:3306 ACCEPT tcp -- 0.0.0.0/0 172.17.0.3 tcp dpt:80 ACCEPT tcp -- 0.0.0.0/0 172.17.0.3 tcp dpt:22
Here 3306 used as the Docker database port on the 172.17.0.2 IP, if this port is not available, run the following command -
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
Now you can easily access the Docker database from your local system by following the configuration
host: 172.17.0.2 adapter: mysql database: DATABASE_NAME port: 3307 username: DATABASE_USER password: DATABASE_PASSWORD encoding: utf8
In CentOS:
First you need to check if the Docker database port is accessible in your firewall by running the following command -
sudo firewall-cmd --list-all
OUTPUT Sample:
target: default icmp-block-inversion: no interfaces: eno79841677 sources: services: dhcpv6-client ssh **ports: 3307/tcp** protocols: masquerade: no forward-ports: sourceports: icmp-blocks: rich rules:
Here 3307 used as the Docker database port on the 172.17.0.2 IP, if this port is not available, run the following command -
sudo firewall-cmd --zone=public --add-port=3307/tcp
On the server you can add a port forever
sudo firewall-cmd --permanent --add-port=3307/tcp sudo firewall-cmd --reload
Now you can easily access the Docker database from your local system using the above configuration.
Sanaulla May 23 '18 at 7:06 2018-05-23 07:06
source share