Running multiple MySQL docker containers

Hi

I have a docker image that has percona-server-5.6 installed. I need to run N number of those containers. Each container will start up a mysql server, load some data and after analysis done, the container will be stopped. And I need to this to work on AWS Batch environment.

I was able to test run multiple local containers (each running a mysql server) without a problem. However, when I submit jobs to AWS Batch, then the first container will always run fine. However, the second container will always have Connection problem, complaining about the port 3306.

Maybe I’m not understanding how Docker works with the ports. But I don’t think the ports should be clashed? And I don’t know why I was able to run two containers locally and have issue when using Batch.

Any help will be appreciated. Also please let me know if I need to provide more details such as the code, Dockerfile etc.