# Bind mount not working

**URL:** <https://forums.docker.com/t/bind-mount-not-working/136265>\
**Category:** General\
**Created:** [May 30, 2023, 8:10pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265 "2023-05-30T20:10:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![galvao](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/galvao/32/40915_2.png) [@galvao](https://forums.docker.com/u/galvao)\
**Post date:** [May 30, 2023, 8:10pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/1 "2023-05-30T20:10:58Z")

</div>

OS: Fedora Linux 36 (KDE) x86\_64  
Kernel: 6.2.15-100.fc36.x86\_64  
Docker version: 24.0.2, build cb74dfc  
Docker Compose version: v2.18.1

I’m having an issue where the bound mount on a docker container just doesn’t work. None of the files in the host show up in the container and while everyone else on the team can easily build their containers I’m the only one left hanging.

A `docker inspect` shows the mount correctly:

```auto
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/var/www/html/ai-solutions/auditoria",
                "Destination": "/var/www/html",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],

```

and yet, abolsutely no files show on the container.

The `docker compose up --build -d` command runs without any errors - images and volumes are created, I can access the containers shells, etc… - but still, no files in the mount and I honestly don’t know what else I can do.

Can anyone please help?

TIA,

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [May 30, 2023, 8:42pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/2 "2023-05-30T20:42:20Z")

</div>

Just to be sure: you are aware that volumes are runtime configuration, and that they are not present during build time.

Since you are on a rhel based system, I can imagine that selinux might cause perfectly configured binds to now work as expected. With `docker run` you would use `-v /var/www/html/ai-solutions/auditoria:/var/www/html:Z` to modify the selinux labels (see [here](https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label)). It works the same way for the short volume syntax, but I have no idea how it needs to be configured for the long syntax.

---

<div class="post-metadata">

**Author:** ![galvao](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/galvao/32/40915_2.png) [@galvao](https://forums.docker.com/u/galvao)\
**Post date:** [May 30, 2023, 8:49pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/3 "2023-05-30T20:49:44Z")

</div>

Hi, thank you for the quick reply. SELinux isn’t running, I have it disabled:

```auto
> getenforce 
Disabled

```

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [May 30, 2023, 8:52pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/4 "2023-05-30T20:52:39Z")

</div>

No idea then. If the source path on the host and the container path are correct, it should be at least listable inside the container, regardless whether the owner/group ip of the folders and files align with the user inside the container.

---

<div class="post-metadata">

**Author:** ![galvao](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/galvao/32/40915_2.png) [@galvao](https://forums.docker.com/u/galvao)\
**Post date:** [May 30, 2023, 8:55pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/5 "2023-05-30T20:55:20Z")

</div>

Exactly. And the paths are absolutely correct… I’ve double checked them a few times.

---

<div class="post-metadata">

**Author:** ![nachocab83](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/nachocab83/32/44588_2.png) [@nachocab83](https://forums.docker.com/u/nachocab83)\
**Post date:** [January 8, 2024, 5:45pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/6 "2024-01-08T17:45:00Z")

</div>

@galvao I’m on the same boat. Did you figure it out?

I’m pretty sure it’s a permissions issue. Some folders work, but others don’t.

The one that doesn’t work for me is the Homebrew folder. This is my setup:

```auto
...
volumes:
    - /usr/local/Cellar/apache-spark/3.5.0/libexec:/spark
    - /usr/local/Cellar/apache-spark:/spark_test
...

```

If I do `docker exec` and `ls -l /spark` I get an empty directory, but surprisingly if I do `ls -l /spark_test` I get the `3.5.0` folder and the `libexec` folder inside it, but none of the other files that both of those directories contain on the host.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/bluepuma77/32/32688_2.png) [@bluepuma77](https://forums.docker.com/u/bluepuma77)\
**Post date:** [January 8, 2024, 6:26pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/7 "2024-01-08T18:26:35Z")

</div>

Well, check user:group for your folders on host. Are they the same or different? Did you start the image with a dedicated used? What’s the default user of your image/Dockerfile?

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [January 8, 2024, 7:00pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/8 "2024-01-08T19:00:37Z")

</div>

> [@nachocab83](#):
>
> I’m pretty sure it’s a permissions issue.

When you don’t have permission to access a folder, you can’t mount it, not to mention that if the Docker daemon is running as root I don’t see why you would have problem with permissions. Are you using Rootless Docker or maybe Docker Desktop? Did you install Docker as a snap package (could happen on Ubuntu)?

> [@nachocab83](#):
>
> The one that doesn’t work for me is the Homebrew folder. This is my setup:

Homebrew is supported on Linux as well, but it is most likely to be used on macOS. If you run macOS, you run Docker DEsktop so you can’t just mount something from the Homebrew folder. You have to add that to the shared folders in the Settings of Docker Desktop, otherwise you just try to mount a folder from the virtual machine where it doesn’t exist and will be created as empty.

But I wouldn’t mount it at all, since that would just mount something built for macOS and wouldn’t work in a container. At least if I’m right and you use macOS.

---

<div class="post-metadata">

**Author:** ![nachocab83](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/nachocab83/32/44588_2.png) [@nachocab83](https://forums.docker.com/u/nachocab83)\
**Post date:** [January 9, 2024, 6:25am UTC](https://forums.docker.com/t/bind-mount-not-working/136265/9 "2024-01-09T06:25:58Z")

</div>

> [@rimelek](#):
>
> You have to add that to the shared folders in the Settings of Docker Desktop

Thanks! I restarted Docker Desktop and it worked.

---

<div class="post-metadata">

**Author:** ![pfaffman1](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/pfaffman1/32/49689_2.png) [@pfaffman1](https://forums.docker.com/u/pfaffman1)\
**Post date:** [July 29, 2024, 3:15pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/10 "2024-07-29T15:15:22Z")

</div>

> [@nachocab83](#):
>
> I’m pretty sure it’s a permissions issue.

This solved my similar problem where I had a single file that was bound/mounted, but changes to the file inside and outside the container were not reflected. When I changed the permissions to the file outside of the container to `666` (not the ideal solution), changes made inside/outside were reflected in the other place.

---

<div class="post-metadata">

**Author:** ![sahilngi425](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/sahilngi425/32/55715_2.png) [@sahilngi425](https://forums.docker.com/u/sahilngi425)\
**Post date:** [February 17, 2025, 1:19am UTC](https://forums.docker.com/t/bind-mount-not-working/136265/11 "2025-02-17T01:19:12Z")

</div>

Hey, I’m using docker desktop without the admin permissions, and I’m facing the same issue. Not able to see my folders mounted from VScode terminal to Docker container?

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [February 17, 2025, 10:12pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/12 "2025-02-17T22:12:47Z")

</div>

2 posts were split to a new topic: [Bind mounted folder appears to be mounted as tmpfs on Ubuntu 22.04 and files are not visible on the host](https://forums.docker.com/t/bind-mounted-folder-appears-to-be-mounted-as-tmpfs-on-ubuntu-22-04-and-files-are-not-visible-on-the-host/146715)

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [February 17, 2025, 10:17pm UTC](https://forums.docker.com/t/bind-mount-not-working/136265/13 "2025-02-17T22:17:38Z")

</div>

Please, check the posts I moveed to a new topic: [Bind mounted folder appears to be mounted as tmpfs on Ubuntu 22.04 and files are not visible on the host](https://forums.docker.com/t/bind-mounted-folder-appears-to-be-mounted-as-tmpfs-on-ubuntu-22-04-and-files-are-not-visible-on-the-host/146715)

If you also see mounted folders as tmpfs, we can continue there. If not, please, share more info about your issue here, including the output of `docker inspect containername` focusing on the Mounts section.

Also the output of

```auto
docker info
docker version

```
