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?
To install packages in a docker container, the packages should be defined in the Dockerfile. If you want to install packages in the Container, use the RUN statement followed by exact download command . You can update the Dockerfile with latest list of packages at anytime and build again to create new image out of it.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With