Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker detection is broken on Mac OS X #2226

Open
dprotaso opened this issue Mar 13, 2024 · 6 comments
Open

Docker detection is broken on Mac OS X #2226

dprotaso opened this issue Mar 13, 2024 · 6 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@dprotaso
Copy link
Member

I have Docker Intel Mac installed (Docker Desktop 4.28.0 (139021) ) and the latest func (main@09537e382daa74fb58ffc11d7aa0929cd2729bd4) complains about DOCKER_HOST not being found

% func build
Building function image
Error: cannot create docker client: docker/podman API not available
Possible causes:
  The docker/podman daemon is not running.
  The DOCKER_HOST environment variable is not set.

It looks like Docker for Mac now supports different context

% docker context ls
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                        KUBERNETES ENDPOINT   ORCHESTRATOR
default             moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
desktop-linux *     moby                Docker Desktop                            unix:///Users/dprotasowski/.docker/run/docker.sock
orbstack            moby                OrbStack                                  unix:///Users/dprotasowski/.orbstack/run/docker.sock
@dprotaso
Copy link
Member Author

I don't believe I added desktop-linux context - I'm assuming it came from upgrading Docker Desktop

@lkingland
Copy link
Member

lkingland commented Mar 14, 2024

I was under the impression you're attempting to use the "host" builder? If so, then the default builder is still either Pack or S2I, so you'll need to either explicitly choose the builder with --builder=host, or set the environment variable FUNC_BUILDER=host, or set a global default in ~.config/func/config.yaml of builder: host

Leaving this open, however, since this needs validation as a bug for those builders

@vpsx
Copy link

vpsx commented May 24, 2024

Hello, I hope it is appropriate to post this here. I seem to have the same issue on Linux:

~% docker version
Client: Docker Engine - Community
 Cloud integration: v1.0.35+desktop.13
 Version:           25.0.3
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        4debf41
 Built:             Tue Feb  6 21:13:09 2024
 OS/Arch:           linux/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.30.0 (149282)
 Engine:
  Version:          26.1.1
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.9
  Git commit:       ac2de55
  Built:            Tue Apr 30 11:48:28 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.31
  GitCommit:        e377cd56a71523140ca6ae87e30244719194a521
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
~% docker context ls
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                 KUBERNETES ENDPOINT   ORCHESTRATOR
default             moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                                           
desktop-linux *     moby                Docker Desktop                            unix:///home/vpsx/.docker/desktop/docker.sock    

Same error as above:

% kn func build
A registry for function images is required. For example, 'docker.io/tigerteam'.
? Registry for function images: docker.io/tigerteam
Note: building a function the first time will take longer than subsequent builds
Building function image
Error: cannot create docker client: docker/podman API not available
Possible causes:
  The docker/podman daemon is not running.
  The DOCKER_HOST environment variable is not set.
Error: exit status 1

Tried choosing --builder=host per above:

% kn func build --builder=host
A registry for function images is required. For example, 'docker.io/tigerteam'.
? Registry for function images: docker.io/tigerteam
Note: building a function the first time will take longer than subsequent builds
Error: "host" is not a known builder. Available builders are "pack" and "s2i"
Error: exit status 1
% kn func version
v0.41.0

Tried setting DOCKER_HOST; not sure if relevant, but it seems strange that it says dial unix /var/run/docker.sock after pointing DOCKER_HOST to the Docker Desktop daemon?

% export DOCKER_HOST=unix:///home/vpsx/.docker/desktop/docker.sock

% kn func build                                                                   
A registry for function images is required. For example, 'docker.io/tigerteam'.                
? Registry for function images: docker.io/tigerteam                                                                                                                                           Note: building a function the first time will take longer than subsequent builds                                                                                                              
Building function image                                                                                                                                                                       
Still building                                                                                                                                                                                
Still building
Yes, still building
Don't give up on me                                                                            
(.....)
c501d664298a: Pulling fs layer
139eebe90b6d: Pulling fs layer
ERROR: failed to initialize docker client: failed to connect to docker socket: dial unix /var/run/docker.sock: connect: connection refused
                                                                                               
Error: failed to build the function: executing lifecycle: failed with status code: 1
Error: exit status 1  

Many thanks in advance for any help.

@stevef1uk
Copy link

I had the same issue. I am trying Rancher desktop. Someone on another issue for another project found the solution:

docker context list --format json 
export DOCKER_HOST=unix:///Users/stevef/.rd/docker.sock 
func build

The value to set in DOCKER_HOST is found from the 1st command above

Copy link
Contributor

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 19, 2024
@dprotaso
Copy link
Member Author

dprotaso commented Oct 7, 2024

/lifecycle frozen

@knative-prow knative-prow bot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
Status: ⭐ New
Development

No branches or pull requests

4 participants