SAI
SAI

Reputation: 11

Not able to upgrade Werkzeug through my Dockerfile

I'm trying to update the werkzeug (py3-werkzeug-2.2.2-r1) to 3.0.6, through my Dockerfile but couldn't and getting this error

#7 [ 3/14] RUN apk add --no-cache git=2.39.5-r0 py3-werkzeug=3.0.6-r0
#7 0.192 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
#7 0.775 fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
#7 1.072 ERROR: unable to select packages:
#7 1.075   py3-werkzeug-2.2.2-r1:
#7 1.075     breaks: world[py3-werkzeug=3.0.6-r0]
#7 ERROR: process "/bin/sh -c apk add --no-cache git=2.39.5-r0 krb5-libs=1.20.2-r1 py3-werkzeug=3.0.6-r0" did not complete successfully: exit code: 1
FROM python:3.10.9-alpine3.17

ENV DATABASE_URL mongodb://127.0.0.1:27017/

#Install dependency packages
RUN apk update && apk upgrade
RUN apk add --no-cache git=2.39.5-r0 py3-werkzeug=3.0.6-r0

Upvotes: 0

Views: 28

Answers (1)

β.εηοιτ.βε
β.εηοιτ.βε

Reputation: 39294

Alpine does not store multiple version of a packages, this is an on-purpose decision from their part, as they do not have the material capacity to store such an amount of packages.

The version 3.17 of Alpine you are using is bundled with the version 2.2.2-r1, as your error is stating.
If you specifically want the version 3.0.6-r0, you'll have to upgrade to a more recent version of Alpine, like the 3.20 one — but sadly, you do not have such an option available if you don't want to also upgrade your Python version.

Another option, in your case, would be to install the Python package via pip instead:

FROM python:3.10.9-alpine3.17

ENV DATABASE_URL mongodb://127.0.0.1:27017/

#Install dependency packages
RUN apk add --no-cache \
      git \
    && pip install \ 
         werkzeug==3.0.6

Also mind the line RUN apk update && apk upgrade, actually does nothing in your image, as it is in a different layer. And it is useless since you are using the option --no-cache in your apk add command.

Upvotes: 0

Related Questions