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

ggcr: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? #1999

Closed
ImBIOS opened this issue Aug 15, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@ImBIOS
Copy link

ImBIOS commented Aug 15, 2024

What I got

󰀵  󱑍 14:49  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.22 via  v20.15.1   8s 
 ➜  docker context ls                
NAME            DESCRIPTION                               DOCKER ENDPOINT                                   ERROR
default *       Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                       
desktop-linux   Docker Desktop                            unix:///home/imbios/.docker/desktop/docker.sock   

󰀵  󱑍 14:49  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.22 via  v20.15.1 
 ➜  encore eject docker encore-nextjs
2:49PM INF compiling Encore application for linux/amd64
2:49PM INF saving image to local docker daemon
2:49PM ERR unable to save docker image error="error loading image: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

What I expect

  • Successfully build the docker image.

Encore Version

encore version v1.39.5

Suspected Root Cause

The code that thrown the error:

https://github.com/encoredev/encore/blob/f8b785d73b213e01f25bbef44bccc5928b26d7e5/cli/daemon/export/export.go#L133-L147

Which from:

// write the image in docker save format first, then load it
resp, err := o.client.ImageLoad(o.ctx, pr, false)
if err != nil {
return "", fmt.Errorf("error loading image: %w", err)
}

Suspected related issues:

Related issues:

Command

encore eject docker encore-nextjs

Tried Potential Solution

  1. After identifying the selected docker context as desktop-Linux and its mismatch with the error given by encore, I switched it to default, and the error was still the same.
  2. After that, I thought it was similar to could not start process: exec: "node": executable file not found in $PATH encoredev/encore#1309, so I restarted my Ubuntu machine, but the error was still there.

Let me know if there is any other info you need.

@ImBIOS ImBIOS added the bug Something isn't working label Aug 15, 2024
@ImBIOS
Copy link
Author

ImBIOS commented Aug 15, 2024

Another log:

󰀵  󱑍 14:32  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.24 via  v20.15.1 
 ➜  docker version
Client: Docker Engine - Community
 Version:           27.1.2
 API version:       1.46
 Go version:        go1.21.13
 Git commit:        d01f264
 Built:             Mon Aug 12 11:50:54 2024
 OS/Arch:           linux/amd64
 Context:           default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

󰀵  󱑍 14:32  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.24 via  v20.15.1 
 ✗  docker context use desktop-linux 
desktop-linux
Current context is now "desktop-linux"

󰀵  󱑍 14:33  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.24 via  v20.15.1 
 ➜  docker version                  
Client: Docker Engine - Community
 Version:           27.1.2
 API version:       1.46
 Go version:        go1.21.13
 Git commit:        d01f264
 Built:             Mon Aug 12 11:50:54 2024
 OS/Arch:           linux/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.33.0 (160616)
 Engine:
  Version:          27.1.1
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.12
  Git commit:       cc13f95
  Built:            Tue Jul 23 19:57:19 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.19
  GitCommit:        2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
 runc:
  Version:          1.7.19
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

󰀵  󱑍 14:33  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.24 via  v20.15.1 
 ➜  encore eject docker encore-nextjs
2:33PM INF compiling Encore application for linux/amd64
2:33PM INF saving image to local docker daemon
2:33PM ERR unable to save docker image error="error loading image: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

󰀵  󱑍 14:33  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.24 via  v20.15.1   11s 
 ✗  encore version                   
encore version v1.39.5

@ImBIOS
Copy link
Author

ImBIOS commented Aug 15, 2024

󰀵  󱑍 14:42  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.24 via  v20.15.1 
 ➜  lsb_release -a  
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       noble

@Rakhmanov
Copy link

This is not a bug, your default context is not working.
When you switch with docker context to the one that does not give you error it does not applying to everything on your machine, only docker cli.

  1. modify your default context to match the one that does not cause error when running docker version.
  2. Alternatively you can provide DOCKER_HOST='unix:///home/imbios/.docker/desktop/docker.sock' environmental var to specify path where docker deamon is listening.

Otherwise you are asking a feature to have ability to specify docker context in go-containerregistry and in the encore.

@ImBIOS
Copy link
Author

ImBIOS commented Sep 20, 2024

@Rakhmanov If I may ask, how do I modify the default context (your first advice)?

UPDATE 1:

I tried, but still can't

󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  docker version                                                                                 
Client: Docker Engine - Community
 Version:           27.3.0
 API version:       1.47
 Go version:        go1.22.7
 Git commit:        e85edf8
 Built:             Thu Sep 19 14:25:51 2024
 OS/Arch:           linux/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.34.0 (165256)
 Engine:
  Version:          27.2.0
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.21.13
  Git commit:       3ab5c7d
  Built:            Tue Aug 27 14:15:15 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.20
  GitCommit:        8fc6bcff51318944179630522a095cc9dbf9f353
 runc:
  Version:          1.1.13
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  docker context ls                                                                              
NAME              DESCRIPTION                               DOCKER ENDPOINT                                   ERROR
default           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                       
desktop-linux *   Docker Desktop                            unix:///home/imbios/.docker/desktop/docker.sock   

󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  echo $DOCKER_HOST                                                   


󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  echo $DOCKER_HOST


󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  export DOCKER_HOST="unix:///home/imbios/.docker/desktop/docker.sock"

󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  echo $DOCKER_HOST                                                   
unix:///home/imbios/.docker/desktop/docker.sock

󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  docker context ls                                                   
NAME            DESCRIPTION                               DOCKER ENDPOINT                                   ERROR
default *       Current DOCKER_HOST based configuration   unix:///home/imbios/.docker/desktop/docker.sock   
desktop-linux   Docker Desktop                            unix:///home/imbios/.docker/desktop/docker.sock   
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.

󰀵  󱑍 16:39  ﱮ encore-nextjs/backend    main !?+27 via 🥟 v1.1.28 via  v20.17.0 
 ➜  encore eject docker encore-nextjs                                                              
4:40PM INF compiling Encore application for linux/amd64
4:41PM INF saving image to local docker daemon
4:41PM ERR unable to save docker image error="error loading image: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

@ImBIOS ImBIOS closed this as completed Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants