google / go-containerregistry

Go library and CLIs for working with container registries
Apache License 2.0
3.08k stars 531 forks source link

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

Open ImBIOS opened 4 weeks ago

ImBIOS commented 4 weeks ago

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

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:

https://github.com/google/go-containerregistry/blob/b8e87ed57b8042c56cc4875aa99e79906b7b9ad5/pkg/v1/daemon/write.go#L66-L70

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 https://github.com/encoredev/encore/issues/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 commented 4 weeks ago

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 commented 4 weeks ago
󰀵  󱑍 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