简体   繁体   中英

Failed to connect mariadb container by Mysql

Hi i trying to connect to Mariadb container by msql. I did it only with Ip address

  k19@k19:~$ docker inspect mariadb | grep IPAddress
    "SecondaryIPAddresses": null,
    "IPAddress": "172.17.0.2",
    "IPAddress": "172.17.0.2",
    k19@k19:~$ mysql -u root -p -h 172.17.0.2

But my instructor want that I do that with --link option, without using an address, and without installing mysql on local computer

Make sure that the containers can actually reach another by using docker networking. I think that more information is needed to be more specific but the following overview is definitely going to help you:

https://runnable.com/docker/basic-docker-networking

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM