run script shell inside docker app and mongodb container not working

0 votes

Hello Every one I need help with my app run on docker and then I have tool for backup data from mongo with shell script 

#!/bin/bash
DIRECTORY="home"
CONTAINER="mongodb"
DB_NAME="pos-rabbit"
BACKUP_PATH="backup"
BACKUP_NAME="Pos-Rabbit_$(date +%Y-%m-%d)"

# Backup
docker exec $CONTAINER mongodump --db $DB_NAME --out /$BACKUP_PATH/$BACKUP_NAME

Please help me 

This is my error

{ [String: '']
  stdout: '',
  stderr: '/bin/sh: 11: docker: not found\n/bin/sh: 12: docker: not found\ntar: Pos-Rabbit_2020-02-19: Cannot stat: No such file or directory\ntar: Exiting with failure status due to previous errors\n/bin/sh: 20: gdrive: not found\n/bin/sh: 25: docker: not 

Mar 7, 2020 in Docker by anonymous
• 120 points
5,264 views

1 answer to this question.

0 votes

Hi,

I think this error occurs because you used shebang  #!/bin/bash. So make sure you installed bash and also replace #!/bin/bash with #!/bin/sh.

Hope this will help.

To know more about it, get your Mongodb certification today.

Thanks.

answered Mar 9, 2020 by MD
• 95,460 points
It still error please help
Are you getting the same error? You have bash installed in your system, right?

Related Questions In Docker

0 votes
1 answer

Different file owner inside Docker container and in host machine Ask

Filesystems, at least in Unix- and Linux-like ...READ MORE

answered Jun 25, 2018 in Docker by Damon Salvatore
• 5,980 points
944 views
0 votes
1 answer

Different file owner inside Docker container and in host machine

Here is what you can try. Since ...READ MORE

answered Jun 27, 2018 in Docker by Atul
• 10,240 points
1,936 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,620 points
3,517 views
0 votes
1 answer
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,714 views
0 votes
1 answer

Yum is not working inside docker container!

Hi@akhtar, Sometime dns is not able to resolve ...READ MORE

answered Apr 22, 2020 in Docker by MD
• 95,460 points
6,289 views
+15 votes
19 answers

How can I run a ‘docker exec’ command inside a docker container?

you can run any command in a ...READ MORE

answered Dec 10, 2018 in Docker by Pramiti
1,229,556 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP