简体   繁体   中英

How to install package with apt-get in Gitlab CI pipeline using micromamba image

I'm using the micromamba image in a Gitlab CI pipeline. I need to install an additional package with apt-get (libgl1-mesa-glx).

With the miniconda image this was working:

image: continuumio/miniconda3:latest

before_script:
  - apt-get update && apt-get install -y libgl1-mesa-glx

With micromamba, it does not work anymore:

image: mambaorg/micromamba:1.1.0-bullseye

before_script:
  - apt-get update && apt-get install -y libgl1-mesa-glx

results in

Reading package lists...
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)

Is this possible at all? Or do I need to generate a custom docker image?

This is because the user you are running the command from is root or non-sudo user. In the first repo, the user automatically comes with root privileges. That's why you can run commands that require sudo authority.

This is explained on the official Dockerhub pages:

Changing the user id or name The default username is stored in the environment variable MAMBA_USER, and is currently mambauser. (Before 2022-01-13 it was micromamba, and before 2021-06-30 it was root.) Micromamba-docker can be run with any UID/GID by passing the docker run... command the --user=UID: GID parameters. Running with --user=root is supported....

Please look at the "Changing the user id or name" section of this page . This problem has several solution, it might be help;

https://gitlab.com/gitlab-org/gitlab-runner/-/issues/248/designs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM