so I am trying to work out what the best way to call this function in my bash script so that is executed in the docker container.
#!/bin/bash
AWS_BUCKET="https://s3-bucket-location.com"
AWS_BUCKET_DEV_FILE="devfile.zip"
AWS_BUCKET_PIC_FILE="WORDPRESSpics.zip"
wordpress_production_S3_download () {
cd /tmp/
wget $AWS_BUCKET/$AWS_BUCKET_PIC_FILE
mv $AWS_BUCKET_PIC_FILE /var/www/html/wp-content/uploads/2017
cd /var/www/html/wp-content/uploads/2017
unzip $AWS_BUCKET_PIC_FILE
rm $AWS_BUCKET_PIC_FILE
chown -R www-data:www-data 12/
}
My thought to run this function in the docker container is something like this
docker exec -ti dockerwordpressmaster_mysql_1 bash -c "wordpress_production_S3_download"
but I get
bash: wordpress_production_S3_download: command not found
I have also tried to subsite the function into the variable i.e
test=$(wordpress_production_S3_download)
docker exec -ti dockerwordpressmaster_mysql_1 bash -c "$test"
but the function "variable" test only executes on the local machine and not in the Docker container like I would like.
Any help with the issue is greatly appreciated