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

Ubuntu 23.10 slim build error docker socket not found #624

Open
AISTALK opened this issue Dec 26, 2023 · 6 comments
Open

Ubuntu 23.10 slim build error docker socket not found #624

AISTALK opened this issue Dec 26, 2023 · 6 comments
Labels

Comments

@AISTALK
Copy link

AISTALK commented Dec 26, 2023

Expected Behavior

"sudo slim --log-level=trace build streamlit_app_image" make slimmed container

Actual Behavior

(.venv) aitalent@aitalent-1-0:~/Code/streamlit_app$ sudo slim --log-level=trace build streamlit_app_image
[sudo] password for aitalent:
time="2023-12-20T18:57:13+05:00" level=debug msg="sysinfo => system.SystemInfo{Sysname:"Linux", Nodename:"aitalent-1-0", Release:"6.5.0-14-generic", Version:"#14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023", Machine:"x86_64", Domainname:"(none)", OsBuild:"", Distro:system.DistroInfo{Name:"Ubuntu", Version:"23.10", DisplayName:"Ubuntu 23.10"}}"
time="2023-12-20T18:57:13+05:00" level=debug msg="param.error.app.options - no app params"
cmd=build info=param.http.probe message='using default probe'
time="2023-12-20T18:57:13+05:00" level=debug msg="customImageTag='', additionalTags=[]string(nil)" app=slim cmd=build
cmd=build info=report file='slim.report.json'
time="2023-12-20T18:57:13+05:00" level=fatal msg=terminating error="docker socket not found" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/slimtoolkit/slim/pkg/app.(*ExecutionContext).FailOn(0xc00068a4c0, {0x2262fe0, 0xc0003f7be0})\n\tgithub.com/slimtoolkit/slim/pkg/app/execontext.go:58 +0x58\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.OnCommand(_, , {, _}, , {, }, {, _}, {0x0, ...}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:208 +0x997\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.glob..func1(0xc0003c1280)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/cli.go:751 +0x5e10\ngithub.com/urfave/cli/v2.(*Command).Run(0x327eb00, 0xc0002d0680)\n\tgithub.com/urfave/cli/[email protected]/command.go:163 +0x583\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc000103520, {0x2280768?, 0x32f1ec0}, {0xc000050080, 0x4, 0x4})\n\tgithub.com/urfave/cli/[email protected]/app.go:313 +0xaa5\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/[email protected]/app.go:224\ngithub.com/slimtoolkit/slim/pkg/app/master.Run()\n\tgithub.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x45\nmain.main()\n\tgithub.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x187\n"


Steps to Reproduce the Problem

link on zipped container
https://drive.google.com/file/d/1J45h66ZebZ51W4knlOUh4909QQRuL3-X/view?usp=sharing
sudo slim --log-level=trace build streamlit_app_image


Specifications

{
"version": "1.1",
"engine": "linux/amd64|Transformer|1.40.7|fc2a26643f26cde441afb267b5a0a17bddc9a897|2023-12-10_07:50:14AM",
"containerized": false,
"host_distro": {
"name": "Ubuntu",
"version": "23.10",
"display_name": "Ubuntu 23.10"
},
"type": "build",
"state": "error",
"target_reference": "streamlit_app_image",
"system": {
"type": "",
"release": "",
"distro": {
"name": "",
"version": "",
"display_name": ""
}
},
"source_image": {
"identity": {
"id": ""
},
"size": 0,
"size_human": "",
"create_time": "",
"docker_version": "",
"architecture": "",
"container_entry": {
"exe_path": ""
}
},
"minified_image_size": 0,
"minified_image_size_human": "",
"minified_image": "",
"minified_image_has_data": false,
"minified_by": 0,
"artifact_location": "",
"container_report_name": "",
"seccomp_profile_name": "",
"apparmor_profile_name": "",
"image_stack": null,
"image_created": false,
"image_build_engine": ""
}

@kcq kcq added the triage label Jan 6, 2024
@kcq
Copy link
Member

kcq commented Jan 6, 2024

@AISTALK do you have Docker installed on your Ubuntu machine? What's the version? How did you install it? Is it just the Docker engine or is it Docker Desktop?

Note that minifying streamlit applications requires you to interact with the temporary container slim creates, so slim can see the websocket interactions in the streamlit app.

@calebAtIspot
Copy link

calebAtIspot commented Jul 10, 2024

Same error on arm64 mac, I have docker installed version 25.0.5 and colima v0.6.9 is running.

slim x myimg:latest
cmd=xray state=started
cmd=xray info=params target='myimg:latest' add-image-manifest='false' add-image-config='false' rm-file-artifacts='false' 
time="2024-07-10T16:18:15-07:00" level=fatal msg="slim: failure" error="docker socket not found" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x64\ngithub.com/slimtoolkit/slim/pkg/util/errutil.FailOn({0x104483658, 0x14000061740})\n\tgithub.com/slimtoolkit/slim/pkg/util/errutil/errutil.go:32 +0x38\ngithub.com/slimtoolkit/slim/pkg/app/master/command/xray.OnCommand(0x140003d8d68, 0x140004ea480, 0x140003d8d88, {0x16d92f557, 0x3d}, 0x1, {0x0, 0x0}, {0x0, 0x0}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/xray/handler.go:178 +0xa08\ngithub.com/slimtoolkit/slim/pkg/app/master/command/xray.glob..func1(0x1400035b400)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/xray/cli.go:337 +0x1710\ngithub.com/urfave/cli/v2.(*Command).Run(0x1055971c0, 0x1400035a800)\n\tgithub.com/urfave/cli/[email protected]/command.go:163 +0x4a8\ngithub.com/urfave/cli/v2.(*App).RunContext(0x140004ad380, {0x1044a2098?, 0x105615e60}, {0x14000118180, 0x3, 0x3})\n\tgithub.com/urfave/cli/[email protected]/app.go:313 +0x808\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/[email protected]/app.go:224\ngithub.com/slimtoolkit/slim/pkg/app/master.Run()\n\tgithub.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x4c\nmain.main()\n\tgithub.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x194\n" version="darwin/arm64|Transformer|1.40.11|latest|latest"

Pretty-printed stack:

stack="goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x64
github.com/slimtoolkit/slim/pkg/util/errutil.FailOn({0x104483658, 0x14000061740})
	github.com/slimtoolkit/slim/pkg/util/errutil/errutil.go:32 +0x38
github.com/slimtoolkit/slim/pkg/app/master/command/xray.OnCommand(0x140003d8d68, 0x140004ea480, 0x140003d8d88, {0x16d92f557, 0x3d}, 0x1, {0x0, 0x0}, {0x0, 0x0}, ...)
	github.com/slimtoolkit/slim/pkg/app/master/command/xray/handler.go:178 +0xa08
github.com/slimtoolkit/slim/pkg/app/master/command/xray.glob..func1(0x1400035b400)
	github.com/slimtoolkit/slim/pkg/app/master/command/xray/cli.go:337 +0x1710
github.com/urfave/cli/v2.(*Command).Run(0x1055971c0, 0x1400035a800)
	github.com/urfave/cli/[email protected]/command.go:163 +0x4a8
github.com/urfave/cli/v2.(*App).RunContext(0x140004ad380, {0x1044a2098?, 0x105615e60}, {0x14000118180, 0x3, 0x3})
	github.com/urfave/cli/[email protected]/app.go:313 +0x808
github.com/urfave/cli/v2.(*App).Run(...)
	github.com/urfave/cli/[email protected]/app.go:224
github.com/slimtoolkit/slim/pkg/app/master.Run()
	github.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x4c
main.main()
	github.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x194
" version="darwin/arm64|Transformer|1.40.11|latest|latest"

The tool dive doesn't work either so there might be something wrong with my setup :(

@calebAtIspot
Copy link

What's really weird is a docker history command against the same image works just fine 🤔

@kcq
Copy link
Member

kcq commented Jul 12, 2024

@calebAtIspot the info you shared shows that the cli failed because it couldn't find the Docker socket (docker socket not found). It's likely because you don't have "Allow the default Docker socket to be used" option in Docker Desktop enabled, so you don't have /var/run/docker.sock and instead your Docker Desktop has its user-specific Docker socket configured. The latest release should be able to detect the Docker Desktop socket and if it's not detecting it then it might be a bug (either way you can use the global --host flag to point to your Docker socket). Do you mind sharing the path of your local Docker socket? The latest release is here

image

@Jeansen
Copy link

Jeansen commented Jul 12, 2024

I tried the latest version like the following, but it does not work:

docker run -it --rm -v /run/user/1000/docker.sock:/var/run/docker.sock dslim/slim build debian

Here's the output:

 marcel  ⋯  tmp  y  dist_linux  docker run -it --rm -v /run/user/1000/docker.sock:/var/run/docker.sock dslim/slim build debian
cmd=build info=param.http.probe message='using default probe'
cmd=build state=started
cmd=build info=params target.type='image' target.image='debian' continue.mode='probe' rt.as.user='true' keep.perms='true' tags='' image-build-engine='internal'
cmd=build state=image.inspection.start
cmd=build info=image id='sha256:48c562c706d6a8a0c1c40f02b95506b20233c4f0261cc07e4e40f0c6e3673163' size.bytes='123894088' size.human='124 MB'
cmd=build info=image.stack index='0' name='debian:latest' id='sha256:48c562c706d6a8a0c1c40f02b95506b20233c4f0261cc07e4e40f0c6e3673163'
cmd=build state=image.inspection.done
cmd=build state=container.inspection.start
cmd=build info=container status='created' name='slimk_1_20240712163225' id='321979d5f05a5596920d243ffd056aab47c180096718c2bb20b1d8119d06621d'
cmd=build info=container status='running' name='slimk_1_20240712163225' id='321979d5f05a5596920d243ffd056aab47c180096718c2bb20b1d8119d06621d'
cmd=build info=container message='obtained IP address' ip='172.17.0.4'
cmd=build info=cmd.startmonitor status='sent'
cmd=build info=event.startmonitor.done data='{"name":"event.monitor.start.failed","data":{"component":"monitor.runner","state":"/","errors":["insufficient permissions"]}}
' status='received.unexpected'
slim: container stdout:
slim: container stderr:
time="2024-07-12T16:32:26Z" level=error msg="sensor: composite monitor - FAN failed to start running"
time="2024-07-12T16:32:26Z" level=error msg="sensor: failed to start composite monitor" error="insufficient permissions"
time="2024-07-12T16:32:26Z" level=error msg="sensor: run finished with error" error="run sensor without monitor failed: insufficient permissions"
time="2024-07-12T16:32:26Z" level=error msg="channel.Server.Start() - loop.Accept error = accept tcp [::]:65501: use of closed network connection"
time="2024-07-12T16:32:26Z" level=error msg="channel.Server.Start() - loop.Accept error = accept tcp [::]:65502: use of closed network connection"
slim: end of container logs =============
cmd=build info=report file='slim.report.json'
time="2024-07-12T16:32:26Z" level=error msg=terminating error="unexpected event type" stack="goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngithub.com/slimtoolkit/slim/pkg/app.(*ExecutionContext).FailOn(0xc0003da3c0, {0x231db60, 0x337f210})\n\tgithub.com/slimtoolkit/slim/pkg/app/execontext.go:58 +0x58\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.OnCommand(_, _, {_, _}, _, {_, _}, {_, _}, {0x0, ...}, ...)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/handler.go:1136 +0x46a5\ngithub.com/slimtoolkit/slim/pkg/app/master/command/build.glob..func1(0xc00046f440)\n\tgithub.com/slimtoolkit/slim/pkg/app/master/command/build/cli.go:760 +0x5d51\ngithub.com/urfave/cli/v2.(*Command).Run(0x3396180, 0xc00036e500)\n\tgithub.com/urfave/cli/[email protected]/command.go:163 +0x583\ngithub.com/urfave/cli/v2.(*App).RunContext(0xc000103520, {0x233bb88?, 0x340d500}, {0xc000050180, 0x3, 0x3})\n\tgithub.com/urfave/cli/[email protected]/app.go:313 +0xaa5\ngithub.com/urfave/cli/v2.(*App).Run(...)\n\tgithub.com/urfave/cli/[email protected]/app.go:224\ngithub.com/slimtoolkit/slim/pkg/app/master.Run()\n\tgithub.com/slimtoolkit/slim/pkg/app/master/app.go:15 +0x45\nmain.main()\n\tgithub.com/slimtoolkit/slim/cmd/slim/main.go:15 +0x187\n"
cmd=build info=fail.on version='linux/amd64|Transformer|1.40.11|1b271555882eacdfb4e6598d6d0552e9b9b1449b|2024-02-02_01:36:22PM'
cmd=build info=exit code='-1' version='linux/amd64|Transformer|1.40.11|1b271555882eacdfb4e6598d6d0552e9b9b1449b|2024-02-02_01:36:22PM' location='/bin'
app='slim' message='GitHub Discussions' info='https://github.com/slimtoolkit/slim/discussions'
app='slim' message='Join the CNCF Slack channel to ask questions or to share your feedback' info='https://cloud-native.slack.com/archives/C059QP1RH1S'
app='slim' message='Join the Discord server to ask questions or to share your feedback' info='https://discord.gg/9tDyxYS'
app='slim' message='Join the Gitter channel to ask questions or to share your feedback' info='https://gitter.im/docker-slim/community'

@Jeansen
Copy link

Jeansen commented Jul 12, 2024

Here's my docker version output:

Client: Docker Engine - Community
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.20.10
 Git commit:        afdd53b
 Built:             Thu Oct 26 09:08:17 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:08:17 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.24
  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
 runc:
  Version:          1.1.9
  GitCommit:        v1.1.9-0-gccaecfc
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
 rootlesskit:
  Version:          1.1.1
  ApiVersion:       1.1.1
  NetworkDriver:    slirp4netns
  PortDriver:       builtin
  StateDir:         /tmp/rootlesskit3432887140
 slirp4netns:
  Version:          1.2.1
  GitCommit:        09e31e92fa3d2a1d3ca261adaeb012c8d75a8194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants