错误:约束无法满足:在更新高山docker文件中的软件包时

时间:2020-08-04 12:24:42

标签: docker dockerfile alpine

在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.

1 个答案:

答案 0 :(得分:2)

您应从v3.10安装此版本,因为您的基本映像将在v3.7中查找,其中包含较早的版本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