1

Here is my Dockerfile:

From i386/ubuntu:14.04
RUN apt-get update
RUN apt-get install -y git cmake ..... and other packages

I created image using this Dockerfile and launched container from this image, and inside container I entered command uname -m and it gives this output:

x86_64

So it means, that I have Ubuntu 14.04 x64. Why do I have x64 Ubuntu instead of x86? I need x86.

halfer
  • 19,824
  • 17
  • 99
  • 186
Vcvv
  • 71
  • 4
  • I guess that `68` is your architecture and `64` is the size of the data units that are processed per instruction. As far as I know they are independent features of a CPU. So if you "need x86", the answer seems to me that you have x86 already. – halfer Jan 06 '18 at 21:43

1 Answers1

0

You might have a 32-bit userspace with a 64-bit kernel. You almost always want a 64-bit kernel, even for a purely 32-bit user-space. Especially if your (virtual) machine has more than 1GB of RAM, because a 32-bit kernel has to use HIGHMEM / PAE hacks and can't just map it all. i.e. i386 Ubuntu may still install an x86-64 kernel, and this is what uname is showing you.

Use file /bin/ls to see if your system binaries are ELF 32-bit LSB executable, Intel 80386 or ELF 64-bit LSB executable, x86-64.


On a more recent distro, you might see ELF 64-bit LSB shared object, x86-64 if it builds packages with position-independent executables (PIE) enabled by default. Hopefully distros aren't doing this for 32-bit code, because PIC/PIE has measurable performance overhead in 32-bit mode, where RIP-relative addressing modes aren't available. Although distros do ship gcc configured with --enable-default-pie, and that does apply to -m32 unless you turn it off. Anyway, PIE executables can use ASLR for the executable, not just for shared libraries, so there's a security advantage for a very small performance cost (in 64-bit code).

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • This maybe should have been a comment. I posted it as an answer because it got too big for a comment. I think i386 Ubuntu doesn't default to an x86-64 kernel, but I'm pretty certainly there is one available in the i386 repo. – Peter Cordes Jan 07 '18 at 06:04