Docker container returns "unknown" for "uname -p" command

1.9k Views Asked by At

I just installed a brand new Ubuntu Server 14.04.2 LTS and also installed docker to run containers. I am facing some problems with it. A container will be used to run Jenkins and some of its jobs runs scripts to install Android NDK/SDK. These scripts are checking for the platform of the current machine using uname -p command. This command runs well on the host machine but it returns unknown in containers as follows:

lemonade@olympus:/$ docker info
Containers: 14
Images: 171
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 199
Execution Driver: native-0.2
Kernel Version: 3.16.0-38-generic
WARNING: No swap limit support
lemonade@olympus:/$ uname -a
Linux olympus 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
lemonade@olympus:/$ uname -p
x86_64
lemonade@olympus:/$ docker run -ti java:7 /bin/bash
root@c6cdbb8a64fb:/# uname -p
unknown
root@c6cdbb8a64fb:/# uname -a
Linux c6cdbb8a64fb 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 GNU/Linux

Does anyone knows why are the containers returning this? Some scripts (which are not coded by us) use this, as well as a lot of makefiles.

Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

I don't know the exact reason why uname -p fail with the java:7 docker image but it seems to be due to the docker debian image. With the ubuntu docker image, everything is fine.

$ docker run debian uname -p
unknown

$ docker run ubuntu uname -p
x86_64

If you look at the Dockerfile dependencies for the java:7 docker image you find out the following: java:7buildpack-deps:jessie-scmbuildpack-deps:jessie-curldebian:jessie

The only thing that breaks the uname -p is the dependency on debian:jessie. What could do is to build your own java:7 docker image, but making it depend on ubuntu instead of debian.

For that you would have to come up with a Dockerfile which is a merge of the ones used to make the java:7 image.

0
On

uname -p seems to be set to unknown for a lot of linux distributions.

Though you don't control those scripts and make files you might want to submit bug reports upstream recommending they change their code to use uname -m instead if they are trying to detect x86_64, armv7l, armv6l, etc.