the frontend-app container can access DB container but i couldn’t access DB container from an external app that locates on an external machine. what should i do to make the external app can access DB container?
these the commands that i use to create these containers
Frontend-app Container:
docker container run -d --name frontend-app --network frontend nginx:latest
DB container:
docker run -d --name database -p 3306:3306 -v /storage/data/mysql:/var/lib/mysql --network localhost -e MYSQL_ROOT_PASSWORD=PW mysql:latest --default_authentication_plugin=mysql_native_password
Have you tried connecting to other services running on the same host? How are you connecting to the DB from the external app? Are you using the correct hostname/IP of the host?
Hi @maximization, Have you tried connecting to other services running on the same host?
ys i can connect DB container from other app containers that in the same host. but i couldn’t connect from external machine.
How are you connecting to the DB from the external app?
i have open 3306 port in Iptables then tried to telnet on port 3306 from the external machine but not reachable
telnet Host_Public_IP 3306
I think this due to DB in private network (localhost network), there is anyway to make DB reachable from external machine without put it in bridge network.