Support for 32-bit images / containers on 64-bit hosts

What is the status of support for 32-bit (x86) containers on 64-bit (x86_64) hosts ?

Is this supported at all ? Any advice on how to build and run such images ?

Since the Linux x86_64 kernel can run 32-bit processes, running them in docker works just fine.

There are some x86 32-bit images out on the docker hub. For example, someone in the community has created these images: https://hub.docker.com/u/i686/

For example: docker run --rm -it i686/ubuntu bash

If I run the following command…

 docker run --rm -it i686/ubuntu bash
 root@48d938458bb8:/# uname -m

I get the following output:

 x86_64

So it seems to me it is not a x86 32-bit image.

The kernel is your host’s kernel. That’s why you see x86_64 here, your container may still be 32 bit.

I’m not aware of a canonical way to check for a 32 or 64 bit container. I would normally run file /bin/bash, or check for the presence of /lib/x64_64-linux-gnu/

getconf LONG_BIT works I believe.

in ~/tmp ❯ docker run --rm -it i686/ubuntu bash

root@00797b9654dc:/# getconf LONG_BIT
32
root@00797b9654dc:/# uname -m
x86_64