Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

BUG: Compose not exposing docker.sock in Docker Desktop for Windows/WSL #1591

Closed
adyanth opened this issue Apr 25, 2021 · 4 comments · Fixed by #1704
Closed

BUG: Compose not exposing docker.sock in Docker Desktop for Windows/WSL #1591

adyanth opened this issue Apr 25, 2021 · 4 comments · Fixed by #1704
Labels
bug 🐞 App is not working correctly.

Comments

@adyanth
Copy link

adyanth commented Apr 25, 2021

Description

When bind mounting /var/run/docker.sock from a compose file, instead of the docker socket, a directory is created both on the host and the container.

Steps to reproduce the issue:

  1. Latest version of Docker Desktop for Windows with WSL 2 enabled 3.3.0 (62916)
  2. Use the below simplified compose file for reference:
version: '3'

services:
  app:
    image: alpine:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    entrypoint: ls
    command:
      - -alh
      - /run
  1. Run both docker-compose up and docker compose up on that file.

Describe the results you received:

C:\Users\adyan\docker-apps\testing-compose>docker-compose up
Docker Compose is now in the Docker CLI, try `docker compose up`

Creating network "testing-compose_default" with the default driver
Creating testing-compose_app_1 ... done
Attaching to testing-compose_app_1
app_1  | total 8K
app_1  | drwxr-xr-x    1 root     root        4.0K Apr 12 15:15 .
app_1  | drwxr-xr-x    1 root     root        4.0K Apr 12 15:15 ..
app_1  | srwxr-xr-x    1 root     root           0 Apr 12 11:58 docker.sock
testing-compose_app_1 exited with code 0

C:\Users\adyan\docker-apps\testing-compose>docker compose up
[+] Running 1/0
 - Container testing-compose_app_1  Recreated                                                                      0.0s
Attaching to app_1
app_1  | total 8K
app_1  | drwxr-xr-x    1 root     root        4.0K Apr 12 15:15 .
app_1  | drwxr-xr-x    1 root     root        4.0K Apr 12 15:15 ..
app_1  | drwxrwxrwx    1 root     root        4.0K Apr 12 15:15 docker.sock
app_1 exited with code 0

C:\Users\adyan\docker-apps\testing-compose>

Describe the results you expected:
Expecting both to create a bind mounted socket (srwxr-xr-x instead of drwxrwxrwx and a C:\var\run\docker.sock folder created).

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:14:53 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.6.0)

Server:
 Containers: 11
  Running: 10
  Paused: 0
  Stopped: 1
 Images: 11
 Server Version: 20.10.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.128-microsoft-standard
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 25GiB
 Name: docker-desktop
 ID: DPRB:NKSP:3RRU:N2S5:W7IK:F3GS:F4B7:D3QE:BBJ3:7PEU:2MIB:2CGN
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Additional environment details (AWS, VirtualBox, physical, etc.):
Windows 10 Pro v20H2 (19042.906) on AMD platform and WSL 2

Moved from docker/cli#3047

@adyanth
Copy link
Author

adyanth commented Apr 25, 2021

Also to note that we cannot workaround using docker-compose CLI since restarting docker or the host and having it autostart uses the new docker compose to bring the containers up which breaks the socket mount :(

@ndeloof
Copy link
Collaborator

ndeloof commented Apr 25, 2021

might be related to #1563

@ndeloof
Copy link
Collaborator

ndeloof commented Apr 26, 2021

Tried to reproduce without success, maybe fixed in 1.0.13 or specific to WSL2 setup?

 ⠿ Container truc_test_1  Created                                                                                                                                                                          0.1s
Attaching to test_1
test_1  | total 8K     
test_1  | drwxr-xr-x    1 root     root        4.0K Apr 26 13:39 .
test_1  | drwxr-xr-x    1 root     root        4.0K Apr 26 13:39 ..
test_1  | srw-rw----    1 root     998            0 Apr 22 16:09 docker.sock

@adyanth
Copy link
Author

adyanth commented Apr 26, 2021

Most probably specific to WSL I believe. I have had no such issues in linux itself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐞 App is not working correctly.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants