user16748949
user16748949

Reputation: 3

Why does php_uname show the name of the host machine?

If I run the following on my Ubuntu machine:

$ uname -a
Linux laptop 5.4.0-81-generic #91~18.04.1-Ubuntu SMP Fri Jul 23 13:36:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

and if I run

$ docker run -i -t php:7.4-cli-alpine3.12 php -r 'print_r(php_uname());'
Linux 1cb5d58282db 5.4.0-81-generic #91~18.04.1-Ubuntu SMP Fri Jul 23 13:36:29 UTC 2021 x86_6

The result is virtually identical. On OSX:

$ docker run -i -t php:7.4-cli-alpine3.12 php -r 'print_r(php_uname());'
Linux eb34336fc3d5 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64

Why don't I see output indicating the container is running Alpine?

Upvotes: 0

Views: 118

Answers (1)

Beowolve
Beowolve

Reputation: 558

Docker container aren't virtual machines, the technology is different. All container use the hosts Linux kernel. You may better think of your container as a namespace inside your host OS. Within this namespace network, disk, pid, mnt... are separated.

This question is already answered multiple times:

$(uname -a) returning the same in docker host or any docker container

Upvotes: 0

Related Questions