-2

I have a container on which I want to install ca-certificates, but despite being ubuntu, it doesn't recognize both apt and apt-get

~ # cat /proc/version
Linux version 5.4.0-109-generic (buildd@ubuntu) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022
~ # apt update
/bin/sh: apt: not found
~ # apt-get update
/bin/sh: apt-get: not found
~ # apk update
/bin/sh: apk: not found
~ # 

no746
  • 97
  • 2
  • 1
    The container is not Ubuntu. You are just running it on a Ubuntu server. – Gerald Schneider Jan 24 '23 at 08:03
  • what is the image name you are using ? – Zareh Kasparian Jan 24 '23 at 08:37
  • `/proc/version` doesn't tell you what distribution you're running; it just contains information about the running kernel...which in a containerized environment is simply the host kernel, so it doesn't tell you anything about the container. – larsks Jan 24 '23 at 12:34

1 Answers1

1

Your commands are failing because your container isn't on ubuntu, that is your host machine.

 cat /proc/version

Is giving you information from the kernel, but its using the kernel of your hostmachine and thus giving you a misleading result. You need to see what os your container is actually running.

Show us your dockerfile, inside the dockerfile you have a section in which you tell the container what image it should be using. If you look at the image being used you'll be able to see what os is running and you can then execute the appropriate commands.

From within the container you should be able to either do

cat /etc/os-release

or if its CentOs :

cat /etc/issue