ERROR: unsatisfiable constraints: while updating package in alpine docker file

ERROR: unsatisfiable constraints: while updating package in alpine docker file

在 docker 文件中,我需要将版本 binutils 升级到 (2.32-r0)(用于扭锁问题 ),而不是 (2.30-r2),它来自 build-base 包。如何实现?

 "Step 1/22 : FROM alpine:3.7.3
  Step 2/22 : RUN apk update
  Step 3/22 : RUN apk add --no-cache --virtual .build-deps build-base
 ---> Running in ed8a939e861c
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/21) Upgrading musl (1.1.18-r3 -> 1.1.18-r4)
(2/21) Installing binutils-libs (2.30-r2)
(3/21) Installing binutils (2.30-r2)
(4/21) Installing gmp (6.1.2-r1)
(5/21) Installing isl (0.18-r0)
(6/21) Installing libgomp (6.4.0-r5)
(7/21) Installing libatomic (6.4.0-r5)
(8/21) Installing pkgconf (1.3.10-r0)
(9/21) Installing libgcc (6.4.0-r5)
(10/21) Installing mpfr3 (3.1.5-r1)
(11/21) Installing mpc1 (1.0.3-r1)
(12/21) Installing libstdc++ (6.4.0-r5)
(13/21) Installing gcc (6.4.0-r5)
(14/21) Installing musl-dev (1.1.18-r4)
(15/21) Installing libc-dev (0.7.1-r0)
(16/21) Installing g++ (6.4.0-r5)
(17/21) Installing make (4.2.1-r0)
(18/21) Installing fortify-headers (0.9-r0)
(19/21) Installing build-base (0.5-r0)
(20/21) Installing .build-deps (0)
(21/21) Upgrading musl-utils (1.1.18-r3 -> 1.1.18-r4)
Executing busybox-1.27.2-r11.trigger
OK: 160 MiB in 32 packages
Removing intermediate container ed8a939e861c
 ---> 016647d36ca9"

after this command executed, i tried to add the below command 


 RUN apk add --no-cache --update \
      binutils=2.32-r0
    
but it throws contraint error.

您应该从 v3.10, as your base image will look against in v3.7 which contain the older version 2.30.0r 安装此版本。

RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main/ binutils=2.32-r0

构建输出

Step 2/2 : RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main/ binutils=2.32-r0
 ---> Running in ab9f30c693dd
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/1) Installing binutils (2.32-r0)
Executing busybox-1.27.2-r11.trigger

对于 SQLite

FROM alpine:3.7.3
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main/ binutils=2.32-r0
RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/v3.12/main sqlite=3.32.1-r0