I have a docker container
which was built by a keycloak
image.
I want to install vim
in the container but I found that I need to have yum
in order to install the vim
. I tried to download yum
from the internet and use rpm to install it, but the container didn't have sudo
to let me change the file permission.
Following is my linux version:
NAME="Red Hat Enterprise Linux"
VERSION="8.0 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.0"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.0 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.0:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.0
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.0"
How can I get any text editor installed in the container?
Minimal RHEL 8 containers do not contain Yum (or DNF) because that requires Python, which inflates the size of an image quite a bit. However, it contains microdnf
which is written in C and which has limited capabilities.
You should be able to do
microdnf install vim
or
microdnf install yum
docker exec -u root -it <container> bash
*then install vim (or what you need) with
microdnf install vim
I ran into the same problem and found a solution. In your Dockerfile
, Try:
FROM jboss/keycloak:8.0.1
USER root
RUN microdnf install <whatever>
HTH.
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.