Skip to content

apt-get pinning not possible with wildcards in RUN statements #25958

Description

@paraknell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions