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 6 in Docker by anonymous
• 120 points
372 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.

Thank You

answered Mar 9 by MD
• 24,500 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,540 points
146 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
521 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
• 9,940 points
968 views
+2 votes
12 answers
0 votes
1 answer
0 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
• 57,530 points
543 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 in Docker by MD
• 24,500 points
247 views
0 votes
1 answer

How to run firefox inside docker container?

Hi@akhtar, Generally, if you run firefox inside docker ...READ MORE

answered Apr 16 in Docker by MD
• 24,500 points
481 views