I am facing a strange problem with my docker. I had to reinstall it as in the following link: Docker Installation on Ubuntu 18.04
I did this installation before, so everything worked out fine. Then I created the network like this:
docker network create --subnet=172.18.0.0/16 mynet123
And finally built my container. But it can't connect to a database remote server. It gives the following error:
So I checked my internet connection from inside docker container and it turned out that I don't have it. So I guess that's the root of the problem. I tried reinstalling docker, changing docker network by specifying other subnet, followed this instruction Stackoverflow solution
But still no result. Does anybody have an idea how I can sort this out?
By the way, this is how I connect to MySQL using python:
dbconn = mysql.connector.connect(host=config["mysql"]["host"], database=config["mysql"]["database"], user=config["mysql"]["user"], password=config["mysql"]["password"])
cursor = dbconn.cursor()
And here is my config:
[mysql]
host = X.X.X.X.
database = database_name
user = root
password = password
*X.X.X.X here is an IP address of the remote host
P.S. I can connect to the remote database from my local machine, containers can connect to the database server via default network. All user permissions in my database are given.