u/DangerousProfile3575

▲ 1 r/docker

Random bind mounts on WSL2

I have some containers running for production with Docker Desktop in Windows Server 2022 (WSL2 backend), and every time the system is rebooted (because they want the system to run only when it is used, so it is shut down every night) it gave me an error like this:

failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: failed to fulfil mount request: open /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c3c215e6291e7ef302bde128905c6ab417a8d6f151f80f5e20ebf844bc82e224: no such file or directory

That means that it is trying to find a mount on the path /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c3c215e.... The problem is that it isn't the path I indicated on the compose.yml file:

services:
    odoo:
        image: odoo:19.0
        container_name: odoo
        depends_on:
            - db
        volumes:
            - odoo-data:/var/lib/odoo
            - ./extra-addons:/mnt/extra-addons
            - ./config:/etc/odoo
...

So it is creating a new mount (a temporal one is what I believe), and whenever the system is reboot that path doesn't exist anymore, so it give me the error mentioned earlier.

On the other hand i have a nginx service with this one, which also has some bind mounts for configuration:

...
nginx:
    image: nginx:stable
    container_name: nginx
    volumes:
        - ./nginx/conf.d:/etc/nginx/conf.d
        - ./nginx/certs:/etc/nginx/certs
    restart: unless-stopped
...

But this service is mounted perfectly, without creating a new path on /run/desktop/.... How can i solve this and why is this happening. Lastly this is the containers inspect:

odoo_container:
    ...
    "Mounts": [
        {
            "Type": "bind",
            "Source": "/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/38b8d7fc8b1872091c39fa535a68a676b74d392987bdbd4be60b649953003172",
            "Destination": "/etc/odoo",
            "Mode": "rw",
            "RW": true,
            "Propagation": "rprivate"
        },
        {
            "Type": "bind",
            "Source": "/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/ecece816d735920a3230dde5be3ef847967c389c4a6132a5c638f406ea9ab606",
            "Destination": "/mnt/extra-addons",
            "Mode": "rw",
            "RW": true,
            "Propagation": "rprivate"
        }
    ...
nginx_container:
    ...
    "Mounts": [
        {
            "Type": "bind",
            "Source": "/home/mickael/odoo-gema/nginx/certs",
            "Destination": "/etc/nginx/certs",
            "Mode": "rw",
            "RW": true,
            "Propagation": "rprivate"
        },
        {
            "Type": "bind",
            "Source": "/home/mickael/odoo-gema/nginx/conf.d",
            "Destination": "/etc/nginx/conf.d",
            "Mode": "rw",
            "RW": true,
            "Propagation": "rprivate"
        }
    ]
    ...
    ...
reddit.com