Issue:-
When launching a container from the application image, application needs to connect to the mysql database running on the host machine. But when you try to connect using the localhost or 127.0.0.1 you get the following error.
Error:-
Effect:-
Application container went down because application was not able to connect to the mysql database.
Resolution:-
Since the mysql database is running on the host machine so it makes sense that we use the --network=host which will disable the docker networking and use the host based networking and than your docker container will be able to connect to the host database since both are in the same network.
docker run -d --network=host project_app1:latest
0 comments:
Post a Comment