The --link
flag is considered a legacy feature, you should use user-defined networks.
You can run both containers on the same network:
docker run -d --name php_container --network my_network my_php_image
docker run -d --name mysql_container --network my_network my_mysql_image
Every container on that network will be able to communicate with each other using the container name as hostname.
Related Contents:
- Docker (Apple Silicon/M1 Preview) MySQL “no matching manifest for linux/arm64/v8 in the manifest list entries”
- How can I initialize a MySQL database with schema in a Docker container?
- Connect to mysql in a docker container from the host
- Docker-compose check if mysql connection is ready
- Setting up MySQL and importing dump within Dockerfile
- Import data.sql MySQL Docker Container
- How do I know when my docker mysql container is up and mysql is ready for taking queries?
- How to connect mysql workbench to running mysql inside docker?
- Installing MySQL in Docker fails with error message “Can’t connect to local MySQL server through socket”
- Connect to Docker MySQL container from localhost?
- Creating a docker mysql container with a prepared database scheme
- Fatal error: Can’t open and lock privilege tables: Table storage engine for ‘user’ doesn’t have this option
- Can not access mysql docker
- How to connect locally hosted MySQL database with the docker container
- How to execute MySQL command from the host to container running MySQL server?
- MYSQL_ROOT_PASSWORD is set but getting “Access denied for user ‘root’@’localhost’ (using password: YES)” in docker container
- Docker Cannot link to a non running container
- Is it possible to install only mysqldump on macOS
- Mysql not starting in a docker container on MacOS after docker update
- MySQL scripts in docker-entrypoint-initdb are not executed
- connecting to a docker-compose mysql container denies access but docker running same image does not
- not able to connect to mysql docker from local
- Docker – Is There Any Difference Between The Two MySQL Docker Images?
- Docker Compose mysql import .sql
- increase max_allowed_packet size in mysql docker
- docker mysql on different port
- Gitlab CI + DinD + MySQL services permission issue
- Executing SQL scripts on docker container
- How to change the default character set of mysql using docker-compose?
- What is the benefit of zerofill in MySQL?
- Set value to NULL in MySQL
- Is there a way to “limit” the result with ELOQUENT ORM of Laravel?
- When to use MyISAM and InnoDB? [duplicate]
- When should I use UNSIGNED and SIGNED INT in MySQL?
- How to import a csv file into MySQL workbench?
- Column calculated from another column?
- From a shell script, how can I check whether a MySQL database exists?
- How to select count with Laravel’s fluent query builder?
- Show Comment of Fields FROM Mysql Table
- How to execute a .sql script from bash
- ERROR! MySQL manager or server PID file could not be found! QNAP
- What does double bars (||) mean in SQL? [duplicate]
- phpmyadmin “no data received to import” error, how to fix?
- Composite Primary Key performance drawback in MySQL
- MySQL: difference of two result sets
- How to update all MySQL table rows at the same time?
- Case Expression vs Case Statement
- ON DUPLICATE KEY + AUTO INCREMENT issue mysql
- SQL query to prepend prefix to existing value in a field
- SQL search multiple values in same field