docker / docker/docs

apt-get pinning not possible with wildcards in RUN statements

Open Beginner friendly
#25,958 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status/triage
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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.