Perform yum and apk in a Dockerimage

Hello ,

I am trying to run a yum or apk in a Docker image . I first took openjdk and in the dockerfile I kept a yum -y update command . I got Yum not found error .

How can I find if a docker image can allow yum in it or not ?
and how for images without yum , how do I install it ?

new to docker . Please forgive me if the query is very basic . Appreciate your help.

does a docker run -ti alpine work?
this opens you a shell.
there you could play with apk.

if you want a yum you just should start with a fedore, rhel, centos, …

2 Likes

yum is a package manager for a particular set of linux distributions ( such as Fedora, red hat enterprise, centos, etc ), much like apt is for ubuntu or pacman is for Arch.

Depending on the flavour of the image you’re using any one of these will be installed, take a look at the openjdk image and checkout the base image that it is building upon. That should get you in the right direction :slight_smile:

1 Like

Hello,

openjdk official image is based on a debian os base image. You can find out by executing :
docker run --rm -it openjdk cat /etc/*rele*
which displays the content of the file identifying the release inside a container

So, in such an image, you can use “apt-get update” and “apt-get install” commands to install new packages.
If you want an image with yum directly, take a look at some centos base image (yum is the default package manager for redhat/centos linux system)

2 Likes