docker link mysql,使用docker --link to mysql

I need to be able to connect to te next docker db:

sudo docker run --name=cmydatabse -v /opt/mysql_data:/var/lib/mysql --env="MYSQL_ROOT_PASSWORD=mypassword" mysql:5.7

using a link command, I want to create a link so I can connect to this database using:

mysql -u -p -h Something P:3306

Is this possible?

解决方案

Links are legacy from docker compose 2 and all recent docker versions.

With a network the containers will recognize each other by the container name