for-win
for-win copied to clipboard
[WSL2] Fail to mount file/directory on windows startup (trying to start container too early ?)
Description
Hi,
I encounter an error each time docker start on logon where it fail to mount bind-mounts volumes. Stopping the containers and restarting them fix the problem, so this is not a problem from the files themselves.
The stack is as follow:
- Docker for windows
- WSL2
-
wsl --version
:-
WSL version: 2.0.14.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.3155
-
-
- All files are inside the WSL2 env
- Compose stack with bind mounts as follow
-
volumes: - ../:/var/www/site
-
-
All containers have
restart: unless-stopped
so they start when docker start
It happen to me and my colleague BUT it wasn't happening to him with is older computer which was way less powerful... It seems like to reproduce you need a powerful computer, as if docker was starting "too fast" and the mount in /mnt/wsl
is not totally ready.
My computer is the MSI Stealth 15M B12UE-042 for spec references.
I don't really know which log to look at to debug, I'm creating this issue with the hope to have maintainers / community help me reduce the scope until we can find a consistent way to reproduce.
Reproduce
This steps give me a 100% reproduction rate on my computer !
Have docker configured to start on windows logon.
In WSL2, execute:
-
mkdir -p ~/docker-win-issue && cd ~/docker-win-issue \ && echo "test" > test-file \ && mkdir test-directory && echo "test" > test-directory/test-file-inside-directory \ && cat > docker-compose.yml << EOF version: '3.7' services: apache: image: httpd:latest volumes: - ./test-directory:/var/www/test-directory - ./test-file:/var/www/test-file restart: unless-stopped EOF
- Start the stack:
docker compose up -d
- Without shutting down the container, docker or wsl, shutdown the computer (classic end of workday, I don't want to have to shutdown my 7 compose stacks and docker and wsl.....)
- Boot up and login
- After a bit, docker start
- If the mounting of the file fail, we got an error like
"Error": "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: error mounting \"/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/19f14e3a7e077143cb6a2752001de60bd840e54322e03be340183c88e743959a\" to rootfs at \"/var/www/test-file\": mount /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/19f14e3a7e077143cb6a2752001de60bd840e54322e03be340183c88e743959a:/var/www/test-file (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type",
- If the mounting of a directory fail, we got no error but the directory inside the container is empty
If I check the aforementioned file on the filesystem, it's correctly here with the right content:
Expected behavior
The container start and the bind-mounts are properly mounted.
docker version
Client:
Cloud integration: v1.0.35+desktop.11
Version: 25.0.3
API version: 1.44
Go version: go1.21.6
Git commit: 4debf41
Built: Tue Feb 6 21:13:00 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Desktop
Engine:
Version: 25.0.3
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: f417435
Built: Tue Feb 6 21:14:25 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 25.0.3
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1-desktop.4
Path: /usr/local/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.6-desktop.1
Path: /usr/local/lib/docker/cli-plugins/docker-compose
debug: Get a shell into any image or container. (Docker Inc.)
Version: 0.0.24
Path: /usr/local/lib/docker/cli-plugins/docker-debug
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: /usr/local/lib/docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.22
Path: /usr/local/lib/docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: /usr/local/lib/docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.0.1
Path: /usr/local/lib/docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /usr/local/lib/docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.5.0
Path: /usr/local/lib/docker/cli-plugins/docker-scout
WARNING: Plugin "/usr/local/lib/docker/cli-plugins/docker-scan" is not valid: failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-scan: no such file or directory
Server:
Containers: 19
Running: 14
Paused: 0
Stopped: 5
Images: 71
Server Version: 25.0.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 5.15.133.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 20
Total Memory: 15.48GiB
Name: docker-desktop
ID: bae87a06-003d-4712-9668-e1d65f4eda05
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
Diagnostics ID
687632F8-FD33-48ED-8E81-B7A273C2A133/20240303145659
Additional Info
I tested and reproduced the problem even with only one stack starting, itself containing only one container
Updated to 4.29.0
, problem is still here
I found an issue committed in 2017 with the same problem #584 . Someone official explained that host-mount volumes are not available in a few seconds after docker starts. It is tracked bu not fixed yet, so I think they will never fix it.
An alternative solution is to give up docker's autostart funtion, and use windows task scheduler instead.
Create a task to start your containers with WSL console after logging on, remember to set a delay to ensure docker is started completely before the task triggered.
Here is a command for starting all containers:
wsl "docker" container list -aq | wsl "xargs" docker container start
@CharlesChou73 Well, I came up with a similar solution some weeks ago...
Dirty but working for me:
In WSL /etc/wsl.conf
file, I added a "command" to be run when WSL start which point to a simple script:
#!/bin/bash
while true; do
if [ "$(docker info -f "{{.OSType}}" 2> /dev/null)" ]; then
echo "Docker running"
break
fi
sleep 1
done
echo "Restarting"
for service in $(docker compose ls --format=json | jq -rc ".[] .ConfigFiles"); do
docker compose --file "$service" restart &
done
A while true loop wait for docker to be running and available inside WSL and then restart all docker compose stacks. I found that having the docker
command responding a 0 exit code is enough for it to be ready to properly mount volumes.
It's hacky as fuck, but working for me ^^
@Tristan-MyAnaPro That's instructive! I think your solution is more elegant ヾ(≧▽≦*)o
FYI, i just downgrade docker desktop to 4.24.2, and the bug gone, refer to https://github.com/docker/for-win/issues/13985
FYI, i just downgrade docker desktop to 4.24.2, and the bug gone, refer to #13985
Downgraded to 4.24.2, and it works well, thanks a lot!
I have same issue in 4.30.0 :S
4.24.2 is dated of 12-10-2023... need fix please...
Cross post from https://github.com/docker/for-win/issues/13985#issuecomment-2155887664
After hours of trial and error testing, I have narrowed down this problem specifically to just bind mounting files (not folders) and using WSL2 for docker-compose.
Reproduction
The simplest repro I came up with was basically a docker-compose.yml
with just one service and an individual file mount.
services:
influxdb:
image: influxdb:1.8
restart: always
ports:
- "8086:8086"
volumes:
- "./influxdb.conf:/influxdb.conf"
# alternatively can use the type: bind syntax which has the same issue
# - type: bind
# source: ./influxdb.conf
# target: /influxdb.conf
Then just create a blank called influxdb.conf
.
The most important step to reproduce this issue is to initialize the docker container using WSL. So first type wsl
to open WSL2 at the current directory, and then docker compose up -d
.
This will create the container with a bind mount of /mnt/c/Users/longz/Desktop/test/influxdb.conf
.
Then if you log out or restart and log back in, the container will have a status of Excited (127)
when Docker Desktop is configured to "start when you sign in to your computer".
Workaround
I found as a workaround, if you start the docker compose from Windows (command prompt), not WSL2, then it will work correctly.
For example from the same directory just run cmd
and then docker compose up -d
, it will create a container with a bind mount of C:\Users\longz\Desktop\test\influxdb.conf
.
This container will start correctly if you log out and log back in.
Logs
When it fails with WSL bind mount
time="2024-06-08T07:46:10.132502900Z" level=info msg="Starting up"
time="2024-06-08T07:46:10.202880400Z" level=info msg="[graphdriver] using prior storage driver: overlay2"
time="2024-06-08T07:46:10.264388100Z" level=info msg="Loading containers: start."
time="2024-06-08T07:46:10.373628100Z" level=info msg="Removing stale sandbox ee9fba78558b36cde4ca5affff4fcca2d893a88ffbfb8429427aefd28ef3497d (f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c)"
time="2024-06-08T07:46:10.390831000Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9c75cf86e2840d2e6be23069440acb96a53bbe33a624a326d4fab1d18a8c12a7 e3cd2cbe49631a54b53dd8c2aecf07581fee5cf7cb55f59447dcd649e7d28234], retrying...."
time="2024-06-08T07:46:10.435127800Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2024-06-08T07:46:10.594770200Z" level=error msg="stream copy error: reading from a closed fifo"
time="2024-06-08T07:46:10.594825700Z" level=error msg="stream copy error: reading from a closed fifo"
time="2024-06-08T07:46:10.612752400Z" level=error msg="f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c cleanup: failed to delete container from containerd: container \"f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c\" in namespace \"moby\": not found"
time="2024-06-08T07:46:10.806178200Z" level=error msg="failed to start container" container=f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c error="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: error mounting \"/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c2760049fc8d5840d923e884d0d5c597983b14a35a07dd23e3fce9b8f080fc27\" to rootfs at \"/influxdb.conf\": mount /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c2760049fc8d5840d923e884d0d5c597983b14a35a07dd23e3fce9b8f080fc27:/influxdb.conf (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type"
time="2024-06-08T07:46:10.806268600Z" level=info msg="Loading containers: done."
time="2024-06-08T07:46:10.817468500Z" level=warning msg="WARNING: No blkio throttle.read_bps_device support"
time="2024-06-08T07:46:10.817501300Z" level=warning msg="WARNING: No blkio throttle.write_bps_device support"
time="2024-06-08T07:46:10.817508100Z" level=warning msg="WARNING: No blkio throttle.read_iops_device support"
time="2024-06-08T07:46:10.817511200Z" level=warning msg="WARNING: No blkio throttle.write_iops_device support"
time="2024-06-08T07:46:10.817513800Z" level=warning msg="WARNING: daemon is not using the default seccomp profile"
time="2024-06-08T07:46:10.817526600Z" level=info msg="Docker daemon" commit=de5c9cf containerd-snapshotter=false storage-driver=overlay2 version=26.1.4
time="2024-06-08T07:46:10.817779000Z" level=info msg="Daemon has completed initialization"
time="2024-06-08T07:46:10.922223200Z" level=info msg="API listen on /var/run/docker.sock"
time="2024-06-08T07:46:10.922306400Z" level=info msg="API listen on /run/guest-services/docker.sock"
time="2024-06-08T07:46:11.884586300Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=9734f53b5c010f77 traceID=70a85b04dae6b8e1eed61279492a76ab
time="2024-06-08T07:51:22.402821015Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=809fa9480d55520e traceID=98f750795508c8218c910caedc28f803
time="2024-06-08T07:51:22.406775154Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=e430ad3d6c1f2dc4 traceID=a5b8a96e770a274da06ceb5a6e91faa6
time="2024-06-08T07:51:22.411005403Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=2e503f3c80cd35fc traceID=491ad4e2ea75f2c13a88bbd50a1afdcf
time="2024-06-08T07:51:22.414956343Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=2801fdf650d385ba traceID=51d82f952b6d1b1a41351a7aeac544e1
time="2024-06-08T07:51:22.418894181Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=07566d24fad9a43e traceID=fff263ebb8faa89bc8359defc738243b
time="2024-06-08T07:51:22.423088929Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=63e06060e803f29a traceID=ce1a9e8048ebaaf80e66637012c8e4de
time="2024-06-08T07:51:22.426915364Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=67f6a0ea5cf3ddd5 traceID=b59eeb439bd14e430b3549f9d709fd4a
time="2024-06-08T07:51:22.431097212Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=5375960a670549ff traceID=8cd07ea66a2ae145aa20c4d16c24e335
time="2024-06-08T07:51:22.435321061Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=0915dc967b22d00d traceID=65527c08ea4ef391692c0a055c860f5b
time="2024-06-08T07:51:22.439222499Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=7cbfc67b3b663796 traceID=b08a0b3ec66a9c1fac2aa9a685455749
time="2024-06-08T07:51:45.128346791Z" level=info msg="ignoring event" container=f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
time="2024-06-08T07:51:45.133030458Z" level=warning msg="ShouldRestart failed, container will not be restarted" container=f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c daemonShuttingDown=false error="restart canceled" execDuration=46.080874533s exitStatus="{0 2024-06-08 07:51:45.123416215 +0000 UTC}" hasBeenManuallyStopped=true restartCount=0
time="2024-06-08T07:51:45.441325975Z" level=error msg="Error setting up exec command in container f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c: container f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c is not running" spanID=42a5f1be7da194e9 traceID=2177681882773035bfc111be4e726530
time="2024-06-08T07:52:13.687265926Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=0e7a632f8f142946 traceID=33e1215940e158c1c3dde3d350cf7e37
When it works with Windows bind mount
time="2024-06-08T07:53:02.925570900Z" level=info msg="Starting up"
time="2024-06-08T07:53:02.988704100Z" level=info msg="[graphdriver] using prior storage driver: overlay2"
time="2024-06-08T07:53:03.055067900Z" level=info msg="Loading containers: start."
time="2024-06-08T07:53:03.157277400Z" level=info msg="Removing stale sandbox 3d85c11f9c934d488f10d1faaa333eac7ef6426463253ad3c79252bfb40f1e78 (e50abc924a28470c95bfda22bbc72d7957eda01e3fa43a3a156bf9a869b819c8)"
time="2024-06-08T07:53:03.174143800Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9c75cf86e2840d2e6be23069440acb96a53bbe33a624a326d4fab1d18a8c12a7 c24396f04d3dc71a80e5f6b27dc8057000cc6d00445a2d492815297daffb0028], retrying...."
time="2024-06-08T07:53:03.221468600Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
time="2024-06-08T07:53:03.681588800Z" level=info msg="Loading containers: done."
time="2024-06-08T07:53:03.694146000Z" level=warning msg="WARNING: No blkio throttle.read_bps_device support"
time="2024-06-08T07:53:03.694185400Z" level=warning msg="WARNING: No blkio throttle.write_bps_device support"
time="2024-06-08T07:53:03.694194000Z" level=warning msg="WARNING: No blkio throttle.read_iops_device support"
time="2024-06-08T07:53:03.694198900Z" level=warning msg="WARNING: No blkio throttle.write_iops_device support"
time="2024-06-08T07:53:03.694203000Z" level=warning msg="WARNING: daemon is not using the default seccomp profile"
time="2024-06-08T07:53:03.694220200Z" level=info msg="Docker daemon" commit=de5c9cf containerd-snapshotter=false storage-driver=overlay2 version=26.1.4
time="2024-06-08T07:53:03.694458700Z" level=info msg="Daemon has completed initialization"
time="2024-06-08T07:53:03.843328700Z" level=info msg="API listen on /var/run/docker.sock"
time="2024-06-08T07:53:03.843348300Z" level=info msg="API listen on /run/guest-services/docker.sock"
time="2024-06-08T07:53:05.140474500Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=0cd989d415ce81bc traceID=4203602522acced71f2b593de56cf083
@longzheng This is good informations 👍. However, your findings and workaround only apply for files mounted from the Windows filesystem, the problem I encounter is for files mounted from the WSL filesystem (and impact files and directory mount).
@bsousaa After upgrading to 4.31.0 the problem is still present, can you update the tags ?
Just updated to 4.32.0, problem is still present
"Error": "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: error mounting \"/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/94506ef7960851c386caa228a2d2f35088ccfc78998065633bcd675fdebae865\" to rootfs at \"/traefik.toml\": mount /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/94506ef7960851c386caa228a2d2f35088ccfc78998065633bcd675fdebae865:/traefik.toml (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type",
Cross post from #13985 (comment)
After hours of trial and error testing, I have narrowed down this problem specifically to just bind mounting files (not folders) and using WSL2 for docker-compose.
Reproduction
The simplest repro I came up with was basically a
docker-compose.yml
with just one service and an individual file mount.services: influxdb: image: influxdb:1.8 restart: always ports: - "8086:8086" volumes: - "./influxdb.conf:/influxdb.conf" # alternatively can use the type: bind syntax which has the same issue # - type: bind # source: ./influxdb.conf # target: /influxdb.conf
Then just create a blank called
influxdb.conf
.The most important step to reproduce this issue is to initialize the docker container using WSL. So first type
wsl
to open WSL2 at the current directory, and thendocker compose up -d
.This will create the container with a bind mount of
/mnt/c/Users/longz/Desktop/test/influxdb.conf
.
Then if you log out or restart and log back in, the container will have a status of
Excited (127)
when Docker Desktop is configured to "start when you sign in to your computer".
Workaround
I found as a workaround, if you start the docker compose from Windows (command prompt), not WSL2, then it will work correctly.
For example from the same directory just run
cmd
and thendocker compose up -d
, it will create a container with a bind mount ofC:\Users\longz\Desktop\test\influxdb.conf
.
This container will start correctly if you log out and log back in.
Logs
When it fails with WSL bind mount
time="2024-06-08T07:46:10.132502900Z" level=info msg="Starting up" time="2024-06-08T07:46:10.202880400Z" level=info msg="[graphdriver] using prior storage driver: overlay2" time="2024-06-08T07:46:10.264388100Z" level=info msg="Loading containers: start." time="2024-06-08T07:46:10.373628100Z" level=info msg="Removing stale sandbox ee9fba78558b36cde4ca5affff4fcca2d893a88ffbfb8429427aefd28ef3497d (f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c)" time="2024-06-08T07:46:10.390831000Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9c75cf86e2840d2e6be23069440acb96a53bbe33a624a326d4fab1d18a8c12a7 e3cd2cbe49631a54b53dd8c2aecf07581fee5cf7cb55f59447dcd649e7d28234], retrying...." time="2024-06-08T07:46:10.435127800Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address" time="2024-06-08T07:46:10.594770200Z" level=error msg="stream copy error: reading from a closed fifo" time="2024-06-08T07:46:10.594825700Z" level=error msg="stream copy error: reading from a closed fifo" time="2024-06-08T07:46:10.612752400Z" level=error msg="f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c cleanup: failed to delete container from containerd: container \"f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c\" in namespace \"moby\": not found" time="2024-06-08T07:46:10.806178200Z" level=error msg="failed to start container" container=f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c error="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: error mounting \"/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c2760049fc8d5840d923e884d0d5c597983b14a35a07dd23e3fce9b8f080fc27\" to rootfs at \"/influxdb.conf\": mount /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/c2760049fc8d5840d923e884d0d5c597983b14a35a07dd23e3fce9b8f080fc27:/influxdb.conf (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type" time="2024-06-08T07:46:10.806268600Z" level=info msg="Loading containers: done." time="2024-06-08T07:46:10.817468500Z" level=warning msg="WARNING: No blkio throttle.read_bps_device support" time="2024-06-08T07:46:10.817501300Z" level=warning msg="WARNING: No blkio throttle.write_bps_device support" time="2024-06-08T07:46:10.817508100Z" level=warning msg="WARNING: No blkio throttle.read_iops_device support" time="2024-06-08T07:46:10.817511200Z" level=warning msg="WARNING: No blkio throttle.write_iops_device support" time="2024-06-08T07:46:10.817513800Z" level=warning msg="WARNING: daemon is not using the default seccomp profile" time="2024-06-08T07:46:10.817526600Z" level=info msg="Docker daemon" commit=de5c9cf containerd-snapshotter=false storage-driver=overlay2 version=26.1.4 time="2024-06-08T07:46:10.817779000Z" level=info msg="Daemon has completed initialization" time="2024-06-08T07:46:10.922223200Z" level=info msg="API listen on /var/run/docker.sock" time="2024-06-08T07:46:10.922306400Z" level=info msg="API listen on /run/guest-services/docker.sock" time="2024-06-08T07:46:11.884586300Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=9734f53b5c010f77 traceID=70a85b04dae6b8e1eed61279492a76ab time="2024-06-08T07:51:22.402821015Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=809fa9480d55520e traceID=98f750795508c8218c910caedc28f803 time="2024-06-08T07:51:22.406775154Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=e430ad3d6c1f2dc4 traceID=a5b8a96e770a274da06ceb5a6e91faa6 time="2024-06-08T07:51:22.411005403Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=2e503f3c80cd35fc traceID=491ad4e2ea75f2c13a88bbd50a1afdcf time="2024-06-08T07:51:22.414956343Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=2801fdf650d385ba traceID=51d82f952b6d1b1a41351a7aeac544e1 time="2024-06-08T07:51:22.418894181Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=07566d24fad9a43e traceID=fff263ebb8faa89bc8359defc738243b time="2024-06-08T07:51:22.423088929Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=63e06060e803f29a traceID=ce1a9e8048ebaaf80e66637012c8e4de time="2024-06-08T07:51:22.426915364Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=67f6a0ea5cf3ddd5 traceID=b59eeb439bd14e430b3549f9d709fd4a time="2024-06-08T07:51:22.431097212Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=5375960a670549ff traceID=8cd07ea66a2ae145aa20c4d16c24e335 time="2024-06-08T07:51:22.435321061Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=0915dc967b22d00d traceID=65527c08ea4ef391692c0a055c860f5b time="2024-06-08T07:51:22.439222499Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=7cbfc67b3b663796 traceID=b08a0b3ec66a9c1fac2aa9a685455749 time="2024-06-08T07:51:45.128346791Z" level=info msg="ignoring event" container=f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete" time="2024-06-08T07:51:45.133030458Z" level=warning msg="ShouldRestart failed, container will not be restarted" container=f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c daemonShuttingDown=false error="restart canceled" execDuration=46.080874533s exitStatus="{0 2024-06-08 07:51:45.123416215 +0000 UTC}" hasBeenManuallyStopped=true restartCount=0 time="2024-06-08T07:51:45.441325975Z" level=error msg="Error setting up exec command in container f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c: container f1d46c06e9dd76be4cb6684d52bd57836656ae9ec97198999dde453829ff555c is not running" spanID=42a5f1be7da194e9 traceID=2177681882773035bfc111be4e726530 time="2024-06-08T07:52:13.687265926Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=0e7a632f8f142946 traceID=33e1215940e158c1c3dde3d350cf7e37
When it works with Windows bind mount
time="2024-06-08T07:53:02.925570900Z" level=info msg="Starting up" time="2024-06-08T07:53:02.988704100Z" level=info msg="[graphdriver] using prior storage driver: overlay2" time="2024-06-08T07:53:03.055067900Z" level=info msg="Loading containers: start." time="2024-06-08T07:53:03.157277400Z" level=info msg="Removing stale sandbox 3d85c11f9c934d488f10d1faaa333eac7ef6426463253ad3c79252bfb40f1e78 (e50abc924a28470c95bfda22bbc72d7957eda01e3fa43a3a156bf9a869b819c8)" time="2024-06-08T07:53:03.174143800Z" level=warning msg="Error (Unable to complete atomic operation, key modified) deleting object [endpoint 9c75cf86e2840d2e6be23069440acb96a53bbe33a624a326d4fab1d18a8c12a7 c24396f04d3dc71a80e5f6b27dc8057000cc6d00445a2d492815297daffb0028], retrying...." time="2024-06-08T07:53:03.221468600Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address" time="2024-06-08T07:53:03.681588800Z" level=info msg="Loading containers: done." time="2024-06-08T07:53:03.694146000Z" level=warning msg="WARNING: No blkio throttle.read_bps_device support" time="2024-06-08T07:53:03.694185400Z" level=warning msg="WARNING: No blkio throttle.write_bps_device support" time="2024-06-08T07:53:03.694194000Z" level=warning msg="WARNING: No blkio throttle.read_iops_device support" time="2024-06-08T07:53:03.694198900Z" level=warning msg="WARNING: No blkio throttle.write_iops_device support" time="2024-06-08T07:53:03.694203000Z" level=warning msg="WARNING: daemon is not using the default seccomp profile" time="2024-06-08T07:53:03.694220200Z" level=info msg="Docker daemon" commit=de5c9cf containerd-snapshotter=false storage-driver=overlay2 version=26.1.4 time="2024-06-08T07:53:03.694458700Z" level=info msg="Daemon has completed initialization" time="2024-06-08T07:53:03.843328700Z" level=info msg="API listen on /var/run/docker.sock" time="2024-06-08T07:53:03.843348300Z" level=info msg="API listen on /run/guest-services/docker.sock" time="2024-06-08T07:53:05.140474500Z" level=error msg="Handler for GET /v1.45/services returned error: This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again." spanID=0cd989d415ce81bc traceID=4203602522acced71f2b593de56cf083
Do you have some explanation for it . I think it can be an issue and solution but cannot connect dots
Do you have some explanation for it .
I think it can be an issue and solution but cannot connect dots
The theory is that Docker is trying to start and use the WSL mount before WSL is loaded/ready.
Do you have some explanation for it . I think it can be an issue and solution but cannot connect dots
The theory is that Docker is trying to start and use the WSL mount before WSL is loaded/ready.
@longzheng How is bound mounting resolving this issue in your case . I tried to replicate but error is not reproducing somehow
@longzheng hi i have a query here,
I if use task scheduler and put a delay in docker desktop starting while we restart the system, can we avoid this issue so by putting this delay wsl will be loaded properly - so that docker desktop can load without any issues
@longzheng hi i have a query here,
I if use task scheduler and put a delay in docker desktop starting while we restart the system, can we avoid this issue so by putting this delay wsl will be loaded properly - so that docker desktop can load without any issues
I am not sure, I have not tested this scenario but I would guess it might work.
same problem !
Solved by doing this:
-
Open WSL terminal
-
Edit your
.bashrc
file:nano ~/.bashrc
-
Add this code at the end of the file:
if [[ "$PWD" == "/mnt/wsl/docker-desktop-bind-mounts/"* ]]; then windows_path=$(wslpath -w "$PWD") echo "Windows path: $windows_path" # Extract the relative path from the Windows path relative_path="${windows_path#*:\\}" relative_path="${relative_path//\\//}" # Find the corresponding WSL path for drive in {c..z}; do if [ -d "/mnt/$drive" ]; then wsl_path="/mnt/$drive/$relative_path" if [ -d "$wsl_path" ]; then cd "$wsl_path" echo "Moved to: $wsl_path" return fi fi done echo "Error: Unable to find corresponding WSL path" fi
-
Save and exit (Ctrl+X, then Y, then Enter)
-
Apply changes:
source ~/.bashrc
This will run once when you start a new terminal session in a Docker bind mount directory.
I shared it in SO, too, don't forget to upvote if it was useful so more people find it if they need: https://stackoverflow.com/a/78778206/3198983
@gsusI Either I'm missing something or... this has nothing to do with the issue I encounter no ?
@bsousaa I did not ping you for every version but as you may guess, this problem is still present and seen on 4.32.0
, 4.33.0
, 4.33.1
and (just tested today) 4.34.0
.
The only solution I found is to run a script on WSL startup to force a restart of every docker compose stack when the docker engine is available (see : https://github.com/docker/for-win/issues/13947#issuecomment-2072223968)