apt-get pinning not possible with wildcards in RUN statements
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 4.7k
- Forks
- 8.5k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 108
Description
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
Specifically in the #run section of the documentation.
https://docs.docker.com/build/building/best-practices/#run
Documentation shows a * character implying that a wildcard is possible with apt-get.
RUN apt-get update && apt-get install -y --no-install-recommends \
s3cmd=1.1.* \
&& rm -rf /var/lib/apt/lists/*
This is not currently possible inside the RUN command as it uses sh and some string multiline configuration.
8.960 Package curl is not available, but is referred to by another package.
8.960 This may mean that the package is missing, has been obsoleted, or
8.960 is only available from another source
8.960
8.961 E: Version '8.5.*' for 'curl' was not found
------
test.Dockerfile:3
--------------------
3 | >>> RUN apt-get update && apt-get install -y --no-install-recommends \
4 | >>> curl=8.5.* \
5 | >>> && rm -rf /var/lib/apt/lists/*
ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends curl=8.5.* && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
If you run it manually inside a container via bash/sh it seems to work.
$ apt-get install -y --no-install-recommends curl=8.5.*
Tried these as well but they fail for a different syntax/space reason.
/bin/sh -c apt-get update && apt-get install -y --no-install-recommends curl=8.5.* && rm -rf /var/lib/apt/lists/*
root@765e66383567:/app# /bin/sh -c apt-get update && apt-get install -y --no-install-recommends \
> curl=8.5.* \
> && rm -rf /var/lib/apt/lists/*
Location
https://docs.docker.com/build/building/best-practices/
Suggestion
No response
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
Open the Docker documentation best-practices page and inspect the #run section and its apt-get example. Reproduce the reported Dockerfile command and compare it with the manual shell behavior, then update the documentation so the version-pinning example accurately reflects supported behavior and verify the rendered example is clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100