Using Oracle Cloud Object Storage as Docker Volume

Object Storage Icon
Deployment Diagram using Oracle Cloud Object Storage as Docker Volumes

By adding a Docker plugin for Oracle Object Storage We can access from the Oracle Cloud Shell as a regular file system way too, see below.

Implementing an Oracle Object Storage Docker Volume Plugin

Installing S3FS Plugin to access to our Object Storage

$ docker plugin install --alias s3fs mochoa/s3fs-volume-plugin --grant-all-permissions --disable
$ docker plugin set s3fs AWSSECRETACCESSKEY=secret
$ docker plugin set s3fs AWSACCESSKEYID=key
$ docker plugin set s3fs DEFAULT_S3FSOPTS="nomultipart,use_path_request_style,url=https://[tenant_id].compat.objectstorage.[region-id].oraclecloud.com/"
$ docker plugin enable s3fs
$ docker plugin ls
ID NAME DESCRIPTION ENABLED
dd00b09fda36 glusterfs:latest GlusterFS plugin for Docker true
558b297906aa s3fs:latest S3FS plugin for Docker true
User Settings access from profile icon
Generate Secret Key Pop-up
Generate Secret Key confirmation dialog showing AWSSECRETACCESSKEY value
List of generated Secret Keys with link to see AWSACCESSKEYID value

Docker Volume Plugin s3fs must be installed in all nodes of your Docker Swarm Cluster in order to work with Docker stacks.

Tenant Details page showing tenant-id and region values

Testing using a Docker container

Object Storage Bucket List
Bucket content and upload button
$ docker volume create -d s3fs docker-shared-bucket
docker-shared-bucket
$ docker run --rm -it -v docker-shared-bucket:/mnt alpine
/ # ls -l /mnt
total 2
drwxr-xr-x 1 root root 0 Oct 6 12:54 certs
-rw-r--r-- 1 root root 1029 Oct 13 19:10 deploy-hook.log
/ # cat /mnt/deploy-hook.log
Tue Oct 13 18:48:07 UTC 2020
/etc/letsencrypt/live/dev-cloud.servehttp.com dev-cloud.servehttp.com

If you change bucket visibility from Private to Public your bucket can be mounted from Docker containers running outside Oracle Cloud, for example development environment, but this setting is not recommended for production.

Using Oracle Cloud Shell

Using Oracle Object Store from Cloud Shell
mochoa@cloudshell:~ (us-ashburn-1)$ cat enable-s3fs.sh
docker plugin install --alias s3fs mochoa/s3fs-volume-plugin:v2.0.4 --grant-all-permissions --disable
docker plugin set s3fs DEFAULT_S3FSOPTS="nomultipart,use_path_request_style,url=https://[tenant-id].compat.objectstorage.[region-id].oraclecloud.com/"
docker plugin set s3fs AWSACCESSKEYID=------
docker plugin set s3fs AWSSECRETACCESSKEY="------"
docker plugin enable s3fs
docker volume create -d s3fs docker-shared-bucket

Using Object Storage in Docker Swarm stacks

Directory structure stored at registry bucket

Performance

root@032f6f481c6a:/mnt# dd if=/dev/zero of=test1.img bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 32.4348 s, 33.1 MB/s
root@032f6f481c6a:/mnt# dd if=test1.img of=/dev/null
2097152+0 records in
2097152+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 12.3321 s, 87.1 MB/s
root@8d9e193fb5b3:/mnt# dd if=/dev/zero of=test1.img bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 590.406 s, 1.8 MB/s
root@8d9e193fb5b3:/mnt# dd if=test1.img of=/dev/null
2097152+0 records in
2097152+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 25.2497 s, 42.5 MB/s

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store