Problem installing mailadm

Hi Guys,

I would like to ask for help.
I am trying to install mailadm, but encountered a problem when building the ducker. After running the command: sudo docker build . -t mailadm-mailcow, i get the error below. I have tried to build it in another machine (local standalone host), as the serverguide explains but I get the same result.
Thank you in advance for your help.
Carlos

=> ERROR [3/9] RUN pip install -U pip 2.6s

[3/9] RUN pip install -U pip:
2.023 error: externally-managed-environment
2.023
2.023 × This environment is externally managed
2.023 ╰─>
2.023 The system-wide python installation should be maintained using the system
2.023 package manager (apk) only.
2.023
2.023 If the package in question is not packaged already (and hence installable via
2.023 “apk add py3-somepackage”), please consider installing it inside a virtual
2.023 environment, e.g.:
2.023
2.023 python3 -m venv /path/to/venv
2.023 . /path/to/venv/bin/activate
2.023 pip install mypackage
2.023
2.023 To exit the virtual environment, run:
2.023
2.023 deactivate
2.023
2.023 The virtual environment is not deleted, and can be re-entered by re-sourcing
2.023 the activate file.
2.023
2.023 To automatically manage virtual environments, consider using pipx (from the
2.023 pipx package).
2.023
2.023 note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
2.023 hint: See PEP 668 for the detailed specification.


I have overpassed this error by changing the image of Alpine to version
alpine:3.18 (FROM docker.io/alpine:3.18 in the Dockerfile) which does NOT need to conform to PEP 668 specification.

1 Like

I have found out that if you want to use latest version of Alpine (> 3.18), you need to modify the “Dockerfile” (I have tested it positively. Source: Elegantly activating a virtualenv in a Dockerfile).

Add the following lines after the ‘Run apk…’ command:

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH=“$VIRTUAL_ENV/bin:$PATH”

This activates the virtualenv to comply with PEP 668 specification.