How to run install rpm in windows dockerfile

I have inherited custom base image, which has .Net Core and Java built-in, that used to create docker image and containerized in Linux.
Is it possible to run install *.rpm within the Docker file?

1 Like

Hi there, thanks for suggestions, I will try today and let you know.

Thanks

You can let us know, but we suspended the user and deleted the post you replied to as it was a spam with AI generated response.

So to have an answer from a human, I can say you can install rpm packages in containers unless the software it installs requires something which is not available in the container like Systemd. Otherwise the same commands can be used as you would use without containers and of course you have to copy the file with the COPY or ADD instructions, or download the file in command line using a RUN instruction.

1 Like

Hi, I have tried to use Add command to add rpm file from https:// to my folder in project, this part didnt gave me error, but when i have tried to RUN rpm -Uvh /tmp/your-package.rpm, build failed with error: your-package.rpm not a rpm (or package manifest).

Thanks.

I didnā€™t want to complicate my previous message but I donā€™t recommend add. The result is not always the same. Whether the file is extracted or just downloaded as a single file depends on the file format and I never know how it works. Use COPY or curl in a RUN instruction. If there is no curl in your container, you either install it first or use another command like wget, or just use multi-stage build and copy the rpm from a previous stage.

1 Like

Sorry, but Iā€™m new to Docker. What do you mean multi-stage build and copy the rpm from a previous stage?

Also, i have noticed some strange details, When i have downloaded rpm to my local windows machine the size of RPM was 14 mb, when i have added the same file from Docker file using Add command ONLY, i have checked Openshift POD and see the file is there but size ONLY 3000 bytes.

My base image has Windows/net/java and assumed run yum install https:// should work, but it does not.

Any more suggestions?

Thanks

Read about multi-stage builds here.

Just to be clear: this can not work when creating a Windows container image.

This can only work when creating a Linux container image, where the base image is a distribution that actually works with rpm (e.g. RHEL, Suse, Amazon Linux, Oracle Linux, CentOS, Fedora). It can not work on Debian, Ubuntu, Alpine, Arch Linux or any other distribution that doesnā€™t use RPM packages.

It takes a long time to link every single concept, idea, solution or leave a detailed explanation, so please search for these, spend time on learning, finding out what these probably mean and ask back if it is still not clear, so more users can get help on the forum.

The size also depends on the fllesystem (block size), although it is a huge differene for a single file, so you probably downloaded different files. Again, I would not use the ADD instruction. Using it is not as clear as the other commands.

When I said Windows, I meant that we are using a .Net Core application/project which we are using to build a Docker container to run on Linux environment.