I am new to scripting and require some assistance. I am building docker container using YML file. I have YML code written to automate my web server (docker-compose.yml) and database server(docker-compose-mongo.yml).
Now I want to build a bash script that will call for both the yml files and run together.
I was wondering what commands do I need to type within my shell script to call for these two yml files and run them together. I initially just used
#!/bin/bash
run docker-compose.yml
But the above code didn't work.
Ps. below is my yml file for the web server
version: "3"
services:
web:
image: nginx:latest
deploy:
replicas: 5
resources:
limits:
cpus: "0.2"
memory: 330M
restart_policy:
condition: on-failure
ports:
- "80:80"
# networks:
# - webnet
# networks:
# webnet:
You can call them separately:
#!/bin/bash
docker-compose -f docker-compose.yml up -d
docker-compose -f docker-compose-mongo.yml up -d
Or combine both nginx and mongo services in the same docker-compose.yml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With