This content originally appeared on DEV Community and was authored by Sourav Chatterjee
Attaching an S3 Bucket as NFS Volume in Docker
We can attach an S3 bucket as a mounted Volume in docker.
We need to use a Plugin to achieve this.
The plugin is
We will first install the plugin
docker plugin install rexray/s3fs:latest S3FS_REGION=us-east-2 S3FS_OPTIONS="allow_other,iam_role=auto,umask=000" --grant-all-permissions
We will have to install the plugin as above ,as it gives access to the plugin to S3.
Once installed we can check using
docker plugin ls
Now we can mount the S3 bucket using the volume driver like below to test the mount.
docker run -ti --volume-driver=rexray/s3fs -v ${aws-bucket-name}:/data ubuntu sleep infinity
Thats it the Volume has been mounted from our S3 Bucket
We can inspect the container and check if the bucket has been mounted
"Mounts": [
{
"Type": "volume",
"Name": "maps-openmaps-schools",
"Source": "",
"Destination": "/data",
"Driver": "rexray/s3fs:latest",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
We can also inspect the volume
$ docker volume inspect maps-openmaps-schools
[
{
"CreatedAt": "0001-01-01T00:00:00Z",
"Driver": "rexray/s3fs:latest",
"Labels": null,
"Mountpoint": "",
"Name": "maps-openmaps-schools",
"Options": null,
"Scope": "global",
"Status": {
"availabilityZone": "",
"fields": null,
"iops": 0,
"name": "maps-openmaps-schools",
"server": "s3fs",
"service": "s3fs",
"size": 0,
"type": ""
}
}
]
This content originally appeared on DEV Community and was authored by Sourav Chatterjee
Sourav Chatterjee | Sciencx (2021-03-31T17:11:22+00:00) AWS S3 as Docker volumes. Retrieved from https://www.scien.cx/2021/03/31/aws-s3-as-docker-volumes/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.