php-perfect / ddev-intellij-plugin

DDEV Tool Integration for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/18813-ddev-integration
BSD 3-Clause "New" or "Revised" License
109 stars 15 forks source link

"Docker is not running" when using Orbstack #258

Closed rfay closed 1 month ago

rfay commented 11 months ago

Is there an existing issue for this?

Are you sure that this bug is related to this DDEV Integration Plugin?

Enter your error report ID (If available)

No response

Describe the bug

I brought up PhpStorm for some testing. I'm using OrbStack, which is a fantastic drop-in replacement for Docker Desktop.

To connect to orbstack you use docker context use orbstack typically. You can switch between various docker contexts and DDEV works great with it. But perhaps the extension isn't using the context?

image

In the situation shown here, DDEV and Orbstack are both working perfectly. Even the default context (docker context use default) works perfectly

Steps to reproduce

Use OrbStack. Try the extension

Additional context

No response

nico-loeber commented 10 months ago

The plugin is running docker info in the root directory of your PHPStorm project to check if docker is running correctly. Could you please provide the output of this command when using orbstack @rfay? Thanks!

rfay commented 10 months ago

docker info is probably not the best thing to use. Maybe just docker ps? If that succeeds, a docker provider is working.

But anyway, here's docker info from colima:

Client:
 Version:    24.0.6
 Context:    colima
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.1
    Path:     /Users/rfay/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.22.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     /Users/rfay/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.9
    Path:     /Users/rfay/.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:     /Users/rfay/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.9
    Path:     /Users/rfay/.docker/cli-plugins/docker-scout

Server:
 Containers: 18
  Running: 8
  Paused: 0
  Stopped: 10
 Images: 27
 Server Version: 24.0.5
 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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 
 runc version: 
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.5.0-10-generic
 Operating System: Ubuntu 23.10
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 5.772GiB
 Name: colima
 ID: 80fc2b0d-e5d9-4339-9691-2b06c92f4d5c
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

And here's docker info from orbstack:

Client:
 Version:    24.0.6
 Context:    orbstack
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.1
    Path:     /Users/rfay/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.22.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     /Users/rfay/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.9
    Path:     /Users/rfay/.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:     /Users/rfay/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.9
    Path:     /Users/rfay/.docker/cli-plugins/docker-scout

Server:
 Containers: 4
  Running: 0
  Paused: 0
  Stopped: 4
 Images: 400
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 091922f03c2762540fd057fba91260237ff86acb
 runc version: 82f18fe0e44a59034f3e1f45e475fa5636e539aa
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.5.7-orbstack-00109-gd8500ae6683d
 Operating System: OrbStack
 OSType: linux
 Architecture: aarch64
 CPUs: 8
 Total Memory: 5.128GiB
 Name: orbstack
 ID: 4c7d2079-f773-4902-9ad7-2fada7d030f1
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
 Default Address Pools:
   Base: 192.168.215.0/24, Size: 24
   Base: 192.168.228.0/24, Size: 24
   Base: 192.168.247.0/24, Size: 24
   Base: 192.168.207.0/24, Size: 24
   Base: 192.168.167.0/24, Size: 24
   Base: 192.168.107.0/24, Size: 24
   Base: 192.168.237.0/24, Size: 24
   Base: 192.168.148.0/24, Size: 24
   Base: 192.168.214.0/24, Size: 24
   Base: 192.168.165.0/24, Size: 24
   Base: 192.168.227.0/24, Size: 24
   Base: 192.168.181.0/24, Size: 24
   Base: 192.168.158.0/24, Size: 24
   Base: 192.168.117.0/24, Size: 24
   Base: 192.168.155.0/24, Size: 24
   Base: 192.168.147.0/24, Size: 24
   Base: 192.168.229.0/24, Size: 24
   Base: 192.168.183.0/24, Size: 24
   Base: 192.168.156.0/24, Size: 24
   Base: 192.168.97.0/24, Size: 24
   Base: 192.168.171.0/24, Size: 24
   Base: 192.168.186.0/24, Size: 24
   Base: 192.168.216.0/24, Size: 24
   Base: 192.168.242.0/24, Size: 24
   Base: 192.168.166.0/24, Size: 24
   Base: 192.168.239.0/24, Size: 24
   Base: 192.168.223.0/24, Size: 24
   Base: 192.168.164.0/24, Size: 24
   Base: 192.168.163.0/24, Size: 24
   Base: 192.168.172.0/24, Size: 24
   Base: 172.17.0.0/16, Size: 16
   Base: 172.18.0.0/16, Size: 16
   Base: 172.19.0.0/16, Size: 16
   Base: 172.20.0.0/14, Size: 16
   Base: 172.24.0.0/14, Size: 16
   Base: 172.28.0.0/14, Size: 16

You only care about server of course.

How about just using ddev version to test, which will error like this if it can't do what it needs to do:

$ ddev version
Could not connect to a Docker provider. Please start or install a Docker provider.
For install help go to: https://ddev.readthedocs.io/en/latest/users/install/
nico-loeber commented 10 months ago

This is the related code... It will run docker info in the root directory of your project with a timeout of 5 seconds in a non login shell. In case the the command returns a non zero exit code, or the process gets interupted / timeouts the check will fail. so one of these conditions seems to happen when using orbstack.

ddev version caused some issues why we switched to ddev --version in the past. Also the plugin does first check if docker is available, because some of its features depend on docker and then if ddev is installed. This would require some change in the init process of the plugin to directly check docker using the ddev binary. docker --version is not an option as it will just check if the docker client is available, not the docker server.

https://github.com/php-perfect/ddev-intellij-plugin/blob/8f40fd575a3a84cecd595b4440eafcbf9c1cc455/src/main/java/de/php_perfect/intellij/ddev/cmd/DockerImpl.java#L7-L19

nico-loeber commented 8 months ago

@rfay, sadly I am not allowed to install orbstack on my business MacBook, so I can't reproduce this issue. I have added additional output to the "Docker is not running" message - the output of docker context show. Maybe you can check in that way which context PHPStorm is using and in case it is using the wrong context, this is probably an ide issue... The new error message is included in release 1.2.1 which I have just created. Hope this helps...

rfay commented 8 months ago

I'll be happy to give you access to a test runner that has orbstack and maybe you can fiddle with it?

AkibaAT commented 1 month ago

I can't confirm this issue with the current versions. The DDEV status is detected correctly for me, and the PHP remote interpreter works as well.

OrbStack 1.7.0 (17311) docker version

Client:
 Version:           26.1.3
 API version:       1.45
 Go version:        go1.21.10
 Git commit:        b72abbb
 Built:             Thu May 16 08:30:38 2024
 OS/Arch:           darwin/arm64
 Context:           orbstack

Server: Docker Engine - Community
 Engine:
  Version:          26.1.4
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       de5c9cf
  Built:            Wed Jun  5 11:29:18 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.7.20
  GitCommit:        8fc6bcff51318944179630522a095cc9dbf9f353
 runc:
  Version:          1.1.13
  GitCommit:        58aa9203c123022138b22cf96540c284876a7910
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

ddev version

 ITEM             VALUE                                    
 DDEV version     v1.23.4                                  
 architecture     arm64                                    
 cgo_enabled      0                                        
 db               ddev/ddev-dbserver-mariadb-10.11:v1.23.4 
 ddev-ssh-agent   ddev/ddev-ssh-agent:v1.23.4              
 docker           26.1.4                                   
 docker-api       1.45                                     
 docker-compose   v2.29.1                                  
 docker-platform  orbstack                                 
 global-ddev-dir  /Users/xxx/.ddev                     
 mutagen          0.17.2                                   
 os               darwin                                   
 router           ddev/ddev-traefik-router:v1.23.4         
 web              ddev/ddev-webserver:v1.23.4 

docker compose v2.27.3 PhpStorm 2024.2.0.1 DDEV IntelliJ Plugin dev-main

rfay commented 1 month ago

I'm unable to confirm. Closing unless we see it again someday. I suppose that this was probably related to the docker context selected.