slimtoolkit / slimtoolkit/slim
docker-slim issue when trying to slim a docker image
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.4k
- Forks
- 840
- PR merge metrics
- No merged PRs in 30d
Description
The actual command to build the docker image is docker build --network=host -t moon:${VERSION}
The command executed to slim the image is
docker-slim build --target moon:${VERSION} --tag moon:${VERSION} --http-probe=false --include-path /
can target and tag have the same value?
The expected behavior is to slim the image while not replacing any file or folder from the actual image
Steps to Reproduce the Problem
Below is the error:
cmd=build info=continue.after mode='enter' message='provide the expected input to allow the container inspector to continue its execution'
cmd=build prompt='USER INPUT REQUIRED, PRESS <ENTER> WHEN YOU ARE DONE USING THE CONTAINER'
cmd=build state=container.inspection.finishing
time="2023-05-10T15:16:19+05:30" level=error msg="ipc.Client.GetEvent(): event channel error = EOF\n"
time="2023-05-10T15:16:19+05:30" level=warning msg="docker-slim: warning" error=EOF stack="goroutine 1 [running]:\nruntime/debug.Stack(0x0, 0xc0005962e0, 0x533665)\n\truntime/debug/stack.go:24 +0x9f\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.WarnOn(0xfca5e0, 0xc000072040)\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:38 +0x54\ngithub.com/docker-slim/docker-slim/pkg/app/master/inspectors/container.(*Inspector).FinishMonitoring(0xc0004abb00)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/inspectors/container/container_inspector.go:1104 +0x271\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(0xc0004f6960, 0xc0004c74f0, 0x7fffb8799b44, 0x1e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:1079 +0x409d\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc00047b4a0, 0x0, 0xc0004b36f0)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:629 +0x321b\ngithub.com/urfave/cli.HandleAction(0xd2e100, 0xeca9b0, 0xc00047b4a0, 0xc00047b4a0, 0x0)\n\tgithub.com/urfave/cli@v1.22.4/app.go:526 +0xfd\ngithub.com/urfave/cli.Command.Run(0xe824d9, 0x5, 0x0, 0x0, 0x1564aa0, 0x1, 0x1, 0xebe395, 0x6c, 0x0, ...)\n\tgithub.com/urfave/cli@v1.22.4/command.go:174 +0x58e\ngithub.com/urfave/cli.(*App).Run(0xc0003656c0, 0xc000030090, 0x9, 0x9, 0x0, 0x0)\n\tgithub.com/urfave/cli@v1.22.4/app.go:279 +0x7e8\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x54\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:8 +0x25\n" version="linux|Transformer|1.37.3|97eb3c8c7f8c4e295a26c13882feb3f0539ab50f|2021-12-10_09:37:29AM"
time="2023-05-10T15:16:19+05:30" level=error msg="channel.CommandClient.Call: c.Read error = EOF"
time="2023-05-10T15:16:19+05:30" level=error msg="ipc.Client.SendCommand() cmd channel call error=EOF\n"
time="2023-05-10T15:16:19+05:30" level=error msg="dockerutil.CopyFromContainer: dclient.DownloadFromContainer() error = API error (404): Could not find the file /opt/dockerslim/artifacts/creport.json in container 08dd4c141ff290a918cd791874f796cb58683e3c207d25242995bea860c9eaad"
time="2023-05-10T15:16:19+05:30" level=fatal msg="docker-slim: failure" error="API error (404): Could not find the file /opt/dockerslim/artifacts/creport.json in container 08dd4c141ff290a918cd791874f796cb58683e3c207d25242995bea860c9eaad" stack="goroutine 1 [running]:\nruntime/debug.Stack(0xc000050800, 0xc000596260, 0x419c85)\n\truntime/debug/stack.go:24 +0x9f\ngithub.com/docker-slim/docker-slim/pkg/util/errutil.FailOn(0xfca900, 0xc0005025c0)\n\tgithub.com/docker-slim/docker-slim/pkg/util/errutil/errutil.go:28 +0x54\ngithub.com/docker-slim/docker-slim/pkg/app/master/inspectors/container.(*Inspector).ShutdownContainer(0xc0004abb00, 0x4, 0xc000596e00)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/inspectors/container/container_inspector.go:1023 +0x65a\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.OnCommand(0xc0004f6960, 0xc0004c74f0, 0x7fffb8799b44, 0x1e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/handler.go:1082 +0x410f\ngithub.com/docker-slim/docker-slim/pkg/app/master/commands/build.glob..func1(0xc00047b4a0, 0x0, 0xc0004b36f0)\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/commands/build/cli.go:629 +0x321b\ngithub.com/urfave/cli.HandleAction(0xd2e100, 0xeca9b0, 0xc00047b4a0, 0xc00047b4a0, 0x0)\n\tgithub.com/urfave/cli@v1.22.4/app.go:526 +0xfd\ngithub.com/urfave/cli.Command.Run(0xe824d9, 0x5, 0x0, 0x0, 0x1564aa0, 0x1, 0x1, 0xebe395, 0x6c, 0x0, ...)\n\tgithub.com/urfave/cli@v1.22.4/command.go:174 +0x58e\ngithub.com/urfave/cli.(*App).Run(0xc0003656c0, 0xc000030090, 0x9, 0x9, 0x0, 0x0)\n\tgithub.com/urfave/cli@v1.22.4/app.go:279 +0x7e8\ngithub.com/docker-slim/docker-slim/pkg/app/master.Run()\n\tgithub.com/docker-slim/docker-slim/pkg/app/master/app.go:15 +0x54\nmain.main()\n\tgithub.com/docker-slim/docker-slim/cmd/docker-slim/main.go:8 +0x25\n" version="linux|Transformer|1.37.3|97eb3c8c7f8c4e295a26c13882feb3f0539ab50f|2021-12-10_09:37:29AM" ```
---
Specifications
=================
- Version: 1.37
- Platform: docker slim is installed in oracle linux 7.9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the docker-slim build entry point in pkg/app/master/commands/build/handler.go and the shutdown and monitoring paths in pkg/app/master/inspectors/container/container_inspector.go. Reproduce the command with the reported Docker image and inspect the EOF and missing creport.json errors. Done means the reported slimming command completes without the container-inspection failure and produces the expected image.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100