Reputation: 732
I have a bash file that runs my apps docker image using docker run -it --network test_network -p 8000:8000 testApp
but I also need to run my mysql image using docker run -it --network test_network -p 3308:3308 mysql/mysql-server
Normally I open a separate terminal window manually to run each one but I'm trying to edit my bash script so that it can do both for me. Not sure how though?
Upvotes: 1
Views: 2614
Reputation: 6641
You can run both in the detached mode. That will not block the script and allow you to run both together. For that, you need to use the -d
or --detach
flag.
docker run --detach -it --network test_network -p 8000:8000 testApp
docker run --detach -it --network test_network -p 3308:3308 mysql/mysql-server
Edit: While the approach mentioned above works, it is better to use docker compose to run multiple containers.
Upvotes: 5