Docker Community Forums

Share and learn in the Docker community.

Run docker command within container

beta
docker

(Soupman99) #1

I have 3 containers. 1 db container. 1 that backups the db container and one that uploads the backup to google cloud storage.

What I want to happen:

  1. my backup gets made

  2. Once complete my backup container calls a script to run a new google cloud storage container which grabs the backup and uploads it.

Right now when I try and do this I keep getting the error:
/bin/bash: docker: command not found

How do I execute a run command from within my makePeriodicBackups.sh script?

docker run --name mydb mongo:3.2.8 /entrypoint.sh
docker run -ti -v $(pwd):/scripts --name dbBackup myBackupImage makePeriodicBackups.sh



makePeriodicBackups.sh
//make backups every night //
docker run --rm -ti -v $(pwd):/scripts --name GoogleCloudStorage google/cloud-sdk  /scripts/uploadscript.sh

(Thiago Lima) #2

Hi, soupman99

If you launch the container from image google/cloud-sdk without the --rm option and then run the /scripts/uploadscript.sh script with the docker exec command it works?


(Soupman99) #3

I figured it out. Turns out I needed to install docker on the container itself too (which I hadn’t) Now it works as expected