Docker: bind the `/ uploads` directory to Amazon S3 storage

I want to transfer my php site from a virtual machine to a docker container. My site saves all uploaded files to the uploads directory. Now I want to transfer all the files to the S3 storage and save further downloads also on Amazon S3. But I do not want to rewrite the loader class of php files. Is it possible to create a symlink folder or a virtual folder in Docker so that all records and reads on the uploads/** path are redirected to S3 Storage.

Docker supports the S3 storage driver , but I'm new to docker and don’t know how the folder should appear in the s3 repository in dockerfile. I did not find other examples.

Thank you for your help.

Update: See Taruns answer. If you also know that AWS Storage Gateway in a hosting environment is the only good solution, please support or share your thoughts.

+5
source share
1 answer

The link to the S3 repository that you posted to configure the Docker registry, not the Docker volumes. You need to map the folder on the hard drive to the container. Therefore, suppose you host /var/www/uploads on the host on your uploads inside the container.

Now you want /var/www/uploads to actually be installed as the S3 backup folder. To do this, Amazon launched AWS Storage Gateway. You can use this to create an S3 backup folder on your system. The following is an Amazon article that details how to set up the same

http://docs.aws.amazon.com/storagegateway/latest/userguide/ManagingLocalStorage-common.html

+4
source

Source: https://habr.com/ru/post/1270668/


All Articles