I'm wondering if it's possible to create concurrent Docker containers (say, up to 5 running at one time) that are each built from the same image. These containers should be totally independent and don't need to communicate with each other.
For context, I'd like to be able to conduct PHPUnit tests against a MySQL database that's contained within the container. Once the unit tests are complete, I'd stop and remove the container and the associated database. Anytime a container is created, there is a SQL script that seeds the database, so we'd be starting with a fresh database with each new container.
Any advice or resources would be appreciated - thank you!
So far I've been able to docker compose up
a service that creates two containers (one container with PHP installed and another container for MySQL) that are able to communicate with each other, but when I try to start up a new pair of containers (say php-2 and mysql-2) the communication between them fails. I've confirmed that the new pair of containers are on the same network, but I'm getting the socket error:
docker /$ mysql -h mysql
ERROR 1130 (HY000): Host [address] is not allowed to connect to this MySQL server
I'm thinking that the complexity of having a pair of containers that talk to each other is overkill for what I'm trying to accomplish, and that this would become more and more complicated as we introduce a third pair of containers, a fourth pair, etc.