<p>No you can't. </p>

<p>S3 is an object storage, accessed over HTTP or REST for example. Just as you can't mount an HTTP address as a directory you can't mount a S3 bucket as a directory.</p>

<p>Having said that there are some workarounds that expose S3 as a filesystem - e.g. 's3fs' project. How reliable and stable they are I don't know.</p>

CC BY-SA 4.0
2021-02-11T18:07:19.053Z
[it is possible indeed](https://blog.vizuri.com/practical-persistent-cloud-storage-for-docker-in-aws-using-rexray-pt-1)

[also for registry](https://docs.docker.com/registry/storage-drivers/s3/)
Bash Stack
CC BY-SA 4.0
2021-08-12T00:32:39.190Z
This should not be the accepted answer.
Soerendip
CC BY-SA 4.0
2019-07-17T05:44:41.520Z
2019-07-17T05:44:41.520Z
MLu
<p>Yes , you can ( and in swarm mode you should )</p>
<ul>
<li><p><a href="https://blog.vizuri.com/practical-persistent-cloud-storage-for-docker-in-aws-using-rexray-pt-1" rel="nofollow noreferrer">rexray example</a></p>
</li>
<li><p><a href="https://stackoverflow.com/questions/49379881/mount-s3fs-as-docker-volume">s3vol example</a></p>
</li>
<li><p><a href="https://docs.docker.com/engine/extend/legacy_plugins/#volume-plugins" rel="nofollow noreferrer">in fact with volume plugins you may attach many things</a></p>
</li>
<li><p><a href="https://docs.docker.com/registry/storage-drivers/s3/" rel="nofollow noreferrer">also for registry</a></p>
</li>
</ul>

CC BY-SA 4.0
2021-02-11T18:11:12.450Z
2021-02-11T18:30:26.363Z
2021-02-11T18:30:26.363Z
Bash Stack
<p>Actually, you can use Fuse (eluded to by the answer above).</p>

<blockquote>
  <p>S3FS-FUSE: This is a free, open-source FUSE plugin and an easy-to-use
  utility which supports major Linux distributions &amp; MacOS. S3FS also
  takes care of caching files locally to improve performance. This
  plugin simply shows the Amazon S3 bucket as a drive on your system.</p>
</blockquote>

<p><a href="https://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/" rel="nofollow noreferrer">https://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/</a></p>

<p>I haven't used it in AWS yet, though I'll be trying it soon.  There is a similar solution for Azure blob storage and it worked well, so I'm optimistic.</p>

CC BY-SA 4.0
2019-07-17T13:16:50.550Z
2019-07-17T13:16:50.550Z
John Humphreys
<p>Yes, you can.
Use Storage Gateway service. It will give you a NFS endpoint. Mount that using kubernetes volumn.
It is possible. I have already achieved this.</p>

CC BY-SA 4.0
2021-02-12T21:34:51.787Z
2021-02-12T21:34:51.787Z
again
<p>I have a Java EE packaged as war file stored in an <code>AWS s3</code> bucket. I will like to mount the folder containing the <code>.war</code> file as a point in my docker container. I have managed to do this on my local machine. Below is an example of a JBoss wildfly deployments. How can I use <code>s3</code> for this ?</p>

<p><code>docker container run -d —name Application -p 8080:8080 -v `pwd` /Application.war: /opt/jboss/wildfly/standalone/deployments/Application.war jboss/wildlfly</code></p>

CC BY-SA 4.0
2019-07-17T14:02:37.757Z
Worth checking https://stackoverflow.com/questions/49379881/mount-s3fs-as-docker-volume (but really, you shouldn't do that in my opinion as it breaks the idea of repeatable self contained artifact of docker containers)
Tensibai
CC BY-SA 4.0
2019-07-17T18:50:23.543Z
@Tensibai Agreed. Could you indicate why you do not bake the war inside the docker image? The docker image should be immutable.
030
CC BY-SA 4.0
2019-07-17T22:12:35.717Z
@030 opposite, I would copy the war in the container at build time, not have a container relying on external source by taking the war at runtime as asked
Tensibai
<docker><amazon-web-services><deployment><amazon-s3><java>
Is it possible to mount an s3 bucket as a point in a docker container?
christian Martin
# Is it possible to mount an s3 bucket as a point in a docker container?

(Asked by: username_0 on 2019-07-17)

I have a Java EE packaged as war file stored in an `AWS s3` bucket. I will like to mount the folder containing the `.war` file as a point in my docker container. I have managed to do this on my local machine. Below is an example of a JBoss wildfly deployments. How can I use `s3` for this ?

`docker container run -d —name Application -p 8080:8080 -v `pwd` /Application.war: /opt/jboss/wildfly/standalone/deployments/Application.war jboss/wildlfly`

**Tags:** docker, amazon-web-services, deployment, amazon-s3, java

> **Comments:**
> **username_1**: Worth checking https://stackoverflow.com/questions/49379881/mount-s3fs-as-docker-volume (but really, you shouldn't do that in my opinion as it breaks the idea of repeatable self contained artifact of docker containers)  
> **username_2**: @username_1 Agreed. Could you indicate why you do not bake the war inside the docker image? The docker image should be immutable.  
> **username_1**: @username_2 opposite, I would copy the war in the container at build time, not have a container relying on external source by taking the war at runtime as asked  

---

## 4 answers

### Answer by username_3 on 2019-07-17. Score: 3 | Accepted answer

No you can't.

S3 is an object storage, accessed over HTTP or REST for example. Just as you can't mount an HTTP address as a directory you can't mount a S3 bucket as a directory.

Having said that there are some workarounds that expose S3 as a filesystem - e.g. 's3fs' project. How reliable and stable they are I don't know.

> **Comments:**
> **username_4**: [it is possible indeed](https://blog.vizuri.com/practical-persistent-cloud-storage-for-docker-in-aws-using-rexray-pt-1)  [also for registry](https://docs.docker.com/registry/storage-drivers/s3/)  
> **username_5**: This should not be the accepted answer.  

---

### Answer by username_4 on 2021-02-11. Score: 4

Yes , you can ( and in swarm mode you should )

* [rexray example](https://blog.vizuri.com/practical-persistent-cloud-storage-for-docker-in-aws-using-rexray-pt-1)
* [s3vol example](https://stackoverflow.com/questions/49379881/mount-s3fs-as-docker-volume)
* [in fact with volume plugins you may attach many things](https://docs.docker.com/engine/extend/legacy_plugins/#volume-plugins)
* [also for registry](https://docs.docker.com/registry/storage-drivers/s3/)


---

### Answer by username_6 on 2019-07-17. Score: 2

Actually, you can use Fuse (eluded to by the answer above).

> S3FS-FUSE: This is a free, open-source FUSE plugin and an easy-to-use
> utility which supports major Linux distributions & MacOS. S3FS also
> takes care of caching files locally to improve performance. This
> plugin simply shows the Amazon S3 bucket as a drive on your system.

<https://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/>

I haven't used it in AWS yet, though I'll be trying it soon. There is a similar solution for Azure blob storage and it worked well, so I'm optimistic.


---

### Answer by username_7 on 2021-02-12. Score: 0

Yes, you can.
Use Storage Gateway service. It will give you a NFS endpoint. Mount that using kubernetes volumn.
It is possible. I have already achieved this.


---

