Docker Bind Mount disconnecting from Container

This is likely something completely to do with Docker, and not the IA docker image, so I posted this on their forums, but I am posting it here as well incase someone here has experienced this! (*cough* @kcollins1 *cough*)

I primarily do my development in networks setup by compose files, where I map a specific local folder into a specific folder on my container. I have noticed recently that I am having an issue consistently where after a short period of time my container will stop receiving the changes for files located inside the mount.

Here is how my compose file is setup:

version: "3"

services:
    frontend:
        image:           inductiveautomation/ignition:8.1.16
        container_name:  frontend
        ports:
        - "80:8088"
        volumes:
        - project_data:/usr/local/bin/ignition/data

volumes:
    project_data:
        driver: local
        driver_opts:
            type: none
            device: "myProjectPath/Data"
            o: bind

At first everything looks fine and works, however after a while I can make changes in VS Code on my Mac directly:
(Note the extra folders)

β”œβ”€β”€ views
β”‚   β”œβ”€β”€ Gemba Boards
β”‚   β”‚   β”œβ”€β”€ Blends
β”‚   β”‚   β”œβ”€β”€ Embedded Views
β”‚   β”‚   β”œβ”€β”€ Filter
β”‚   β”œβ”€β”€ General

That do not make their way into the container if I actually attach to it to look at its file contents

β”œβ”€β”€ views
β”‚   β”œβ”€β”€ Gemba Boards
β”‚   β”‚   β”œβ”€β”€ Blends
β”‚   β”œβ”€β”€ General

Potentially relevant note is that I am also using git, and this typically happens when I am switching between git branches. So it may be something to do with the large amount of files being changed at once?

Restarting the container does not resolve this issue, however completely restarting Docker Desktop does (Which I am pretty sure is also restarting the engine, so I am not sure which thing is fixing this.)

MacOS Version: Monterey 12.4
Docker Desktop Version: 4.8.1 (78998)
Docker Engine Version: 20.10.14
Compose: v2.5.0
Ignition Version: inductiveautomation/igntion:8.1.16

Any ideas are greatly appreciated!

Docker forum post link for reference: Device Bind Mount Disconnecting from Container Directory - Docker Desktop for Mac - Docker Community Forums
Docker Issue Link for reference: Device Bind Mount Disconnecting from Container Directory Β· Issue #6317 Β· docker/for-mac Β· GitHub

Let's gather a few more details here just to make sure the stage is fully set here... What are you using for the file sharing configuration? There are a few options out there for macOS and Docker Desktop. Right now, the "standard" setup is gRPC FUSE for file sharing (there is also a "legacy" option that is osxfs option). The "experimental" feature is using the new Monterey VirtioFS feature. Probably would need to know which one of these you're using at the moment.

Other unrelated notes.. 😁

On a side note, my preliminary testing of the VirtioFS experimental feature yielded the following enticing results:

Some local testing of new VirtioFS framework for macOS w/ Docker. Gateway startup with bind-mount to fresh data volume, 63 seconds as a before time (versus 11 seconds for a standard startup w/ named volume). With VirtioFS framework as well as Big Sur virtualization.framework, 16 seconds for standard startup w/ bind mount (8 seconds for restart). With named volume, looks like 10 seconds for standard, 7 seconds for restart.

That said, not sure I'm ready to recommend turning it on full-time just yet.

1 Like

So I think I’ve run into this before when trying to help folks get bind mounts to work. Take a look at this little adventure I went on (no sound):

It appears that a simple container lifecycle event is enough to induce β€œtrouble” in that volume. (I’m currently using gRPC FUSE, btw). Solution was as you describe–restart Docker Desktop (and thusly the underlying VM+Docker Engine).

EDIT: So this does feel like a bug in Docker Desktop. I’m sure you could replicate this same behavior in even a basic base image with a similarly configured mount.

Just tested this on Linux directly and am not experiencing this issue, so more pointers towards the special filesystem bridging via Docker Desktop…

Tested it also on my personal M1 Pro MBP (where I’ve been testing out the new VirtioFS framework). It also seems to work correctly there (new virtualization framework and VirtioFS enabled), so that is promising. No warranties expressed or implied, YMMV, and other suitable disclaimers if you go this route. :smiley:

Currently its set to use gRPC FUSE for file sharing.

Oooh exciting. Currently they take forever to start up. Would be nice if this also fixed the "Containers first start with a reference path for a bind mount issue"

Perfect video! Sounds like I need to poke their bug tracker to see if I can get this called out there.

Any chance have you tried this on an intel Mac? While I would love to be testing this on an M1 Mac, sadly, I am not lol

Completely separately, what is that terminal extension you are using to get the nice terminal paths?

Looks promising..

EDIT: and it seems I was able to turn those settings back off without any transition issues..

1 Like

oh-my-zsh with agnoster theme is what I'm using right now..

1 Like