slimtoolkit / slimtoolkit/slim

Building in a wrong folder results in weird errors about unrelated programs

Open
#180 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Go
Stars
23.4k
Forks
841
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

When doing a build while specifying a wrong relative path to a Dockerfile, the error output should say something about that file not being found instead of a totally unrelated program.

This is the command that I used:
sudo docker-slim build --http-probe=false --dockerfile containers/base/Dockerfile --tag lalalala.dkr.ecr.us-east-2.amazonaws.com/smalltest --mount /var/run/docker.sock:/var/run/docker.sock --mount /usr/bin/docker:/usr/bin/docker --show-clogs --entrypoint "entrypoint_dockerslim" .


Actual Behavior

During build, this error popped up and stops the build:

cmd=build info=build.error status=standard.image.build.error value='cannot open "/home/thesheeep/.config/copyq/.copyq_s" for reading: open /home/thesheeep/.config/copyq/.copyq_s: no such device or address'

The error that I got was so weird and confusing ("wtf does CopyQ have to do with anything?!") that it took me quite a while to figure out what was actually the problem.
The actual problem here was that I ran the command above in my home folder (I was just silly and forgot to cd to the correct folder beforehand), so obviously there is no <home>/containers/base/Dockerfile.
If docker-slim had just flat out told me "The Dockerfile you specified could not be found" or something similar, I could have done my facepalm much earlier.

Maybe a sanity check of all the arguments passed would be in order just to improve error output for sleepyheads like myself a bit 🤣


Specifications

  • Version: docker-slim version linux|Transformer|1.34.0-16-gdc85082|dc85082121a8abf5c3984668b8a0c87d3fd7a51a|2021-02-16_07:58:23AM
  • Platform: Manjaro Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the docker-slim build command from an incorrect working directory with the relative Dockerfile path shown. Trace the build entry point until the path is handled, then make the failure identify the missing Dockerfile instead of reporting an unrelated file; verify the resulting error with the same command.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.