How do I install mc in the container?


I would like to work in the php:8.1-apache-bullseye (Docker Hub)
container to install mc (
Without using an extra mc container for this.

For this purpose I tried to install the mc via the Dockerfile.
Unfortunately, this did not work:

FROM php:8.1-apache-bullseye

RUN apt-get update && apt-get install -y \
        less \
        git \
        vim \
        jq \
        libzip-dev \
        zip \
        unzip \
        mariadb-client \
        libjpeg62-turbo \
        libjpeg62-turbo-dev \
        libpng-dev \
        libfreetype6-dev \
        libssl-dev \
        libxml2-dev \
        imagemagick \
        openssl \
        rsync \
	mc \

Try doing this at the end of the Dockerfile file:

RUN apt-get -y install mc

# CMD bash
CMD ["apache2-foreground"]

it doesn’t work either.
If I log into the container as root user:

docker-compose exec --user root php bash

and install with

apk add --no-cache mc

the mc is installed!

So the Alpien Linux runs in the container:

cat /etc/*-release
NAME="Alpine Linux"
PRETTY_NAME="Alpine Linux v3.15"

The question is.
How can I install mc via the Dockerfile?
Or after “booting” the container?

Many greetings

You want to use a debian bullseye base image and Alpine runs in the container? that is not possible. Make sure you use the right base images and use apt in debian based containers and apk in alpine based containers. When something doesnt work, please, share the error message so we can help to interpret it.