Files getting locked on shared volume using Docker for Windows

Issue Type: networking/volumes
OS Version/build: Docker for Windows
App version: Latest as of 12/19/2016
Steps to reproduce: Not certain but generally this is what I did: Clone Laradock from github. Use docker compose to stand up the following services: mysql/apache2. Set up a Laravel+Angular 2 project, use IDE on host such as IntellIJ to edit files. Work on site until some pages stop loading.

I have encountered a problem where files get locked (file is in use by another process), but are still readable (as well as something goes wrong with the Apache 2 container).

The environment is Windows For Docker, using an Apache2, PHP, and MySQL set of containers (from Laradock). There is a shared volume among these containers and my IDE (IntelliJ).

After launch of the containers, the environment works fine for a period of time. Eventually some pages stop loading in the browser and from what I can tell one or more files become locked because they are in use.

Restarting Apache does not help, but restarting the entire Apache 2 container does, which makes me suspect an issue with Docker volumes, not the Apache 2 container.

Any thoughts on a possible root cause/solution?

We’re seeing the same thing.

Running Docker on Windows 10, sharing C drive:

   - $HOME/dev:/root/dev
   - $HOME/.m2:/root/.m2

Thought it was Tomcat and/or Apache, but locks persist after shutting them down.

Locks are not released until we shut down Docker.

Getting file locking on mounted drive.

Host OS: Windows 10
Docker Version: 18.06.1-ce-win73 (19507)

Cannot consistently replicate.

Work Around: Close Docker process. This releases the file(s) from the lock.

No solution for three years? Same for me here with latest Docker on WSL2. Locks not released unless docker is shut down.

Hello, I have a similar problem, and it’s easy to replicate:

  1. mount a volume with an executable inside
  2. run the executable (from container cli as well)
  3. the executable exits, but the lock is still in use, and I cannot write the file from both host and container (until i stop the container)
    Seems like the lock persists even after the process execution exits, because is held globally from vm and not from the process itself (of course, host system won’t be aware of container processes, but would be great if, once the executable exits, container will free its lock)

2024 and I think I’m running into this same bug, manifesting as problems with pnpm on files in a shared volume. Files are held locked, which prevents them from being move/removable, causing errors. I have to restart the container to release the locks.