Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable i386? #81

Closed
vk496 opened this issue Aug 6, 2019 · 5 comments
Closed

How to enable i386? #81

vk496 opened this issue Aug 6, 2019 · 5 comments
Labels

Comments

@vk496
Copy link

vk496 commented Aug 6, 2019

Is this a bug report, feature (enhancement) request or question? (leave only one on its own line)

/kind question

Description:

How can I register the qemu-static-i386?

Steps to reproduce the issue:

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes          
Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm
Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb
Setting /usr/bin/qemu-sparc32plus-static as binfmt interpreter for sparc32plus
Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc
Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64
Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le
Setting /usr/bin/qemu-m68k-static as binfmt interpreter for m68k
Setting /usr/bin/qemu-mips-static as binfmt interpreter for mips
Setting /usr/bin/qemu-mipsel-static as binfmt interpreter for mipsel
Setting /usr/bin/qemu-mipsn32-static as binfmt interpreter for mipsn32
Setting /usr/bin/qemu-mipsn32el-static as binfmt interpreter for mipsn32el
Setting /usr/bin/qemu-mips64-static as binfmt interpreter for mips64
Setting /usr/bin/qemu-mips64el-static as binfmt interpreter for mips64el
Setting /usr/bin/qemu-sh4-static as binfmt interpreter for sh4
Setting /usr/bin/qemu-sh4eb-static as binfmt interpreter for sh4eb
Setting /usr/bin/qemu-s390x-static as binfmt interpreter for s390x
Setting /usr/bin/qemu-aarch64-static as binfmt interpreter for aarch64
Setting /usr/bin/qemu-aarch64_be-static as binfmt interpreter for aarch64_be
Setting /usr/bin/qemu-hppa-static as binfmt interpreter for hppa
Setting /usr/bin/qemu-riscv32-static as binfmt interpreter for riscv32
Setting /usr/bin/qemu-riscv64-static as binfmt interpreter for riscv64
Setting /usr/bin/qemu-xtensa-static as binfmt interpreter for xtensa
Setting /usr/bin/qemu-xtensaeb-static as binfmt interpreter for xtensaeb
Setting /usr/bin/qemu-microblaze-static as binfmt interpreter for microblaze
Setting /usr/bin/qemu-microblazeel-static as binfmt interpreter for microblazeel
Setting /usr/bin/qemu-or1k-static as binfmt interpreter for or1k

Describe the results you received:

List of different architectures that works perfectly

Describe the results you expected:

The i386 arch

Environment:

  • QEMU version:
  • Container application: Docker

Output of docker version, podman version or singularity version

docker version                    ✔  10066  17:36:04
Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89e8a
 Built:             Thu Jul 25 21:17:37 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89e8a
  Built:            Thu Jul 25 21:27:55 2019
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.7.m
  GitCommit:        85f6aa58b8a3170aec9824568f7a31832878b603.m
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Additional information optionally:

@junaruga
Copy link
Member

junaruga commented Aug 6, 2019

@vk496 good point! thanks for the feedback!

Certainly /usr/bin/qemu-i386-static is not included in the result of docker run --rm --privileged multiarch/qemu-user-static --reset -p yes .
But it actually works.

Which kind of Linux distribution's i386 container do you want to run?

If you want to run ubuntu's i386 container image, using i386/ubuntu image ( https://hub.docker.com/r/i386/ubuntu/ ) looks good.
Here is the i386 's case with the i386 image with the Travis CI.

You can refer this repository's "i386" case in .travis.yml.
https://github.com/junaruga/ci-multi-arch-test/blob/master/.travis.yml#L24-L27
https://travis-ci.org/junaruga/ci-multi-arch-test/jobs/567486350

file command shows 32-bit for the compiled binary on the environment.
bin/hello binary (C program to identity the environment) shows 32-bit.

$ file bin/hello
bin/hello: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib, for GNU/Linux 3.2.0, BuildID[sha1]=48eb3582abea27022b746ae6587bda9767896eaf, not stripped

$ bin/hello
Hello World!
Endian Type: Little-endian
Bit: 32-bit
Sizeof {int, long, long long, void*, size_t, off_t}: {4, 4, 8, 4, 4, 4}

The tricky point is when uname command shows x86_64, it can be actually i386 environment depending on the environment.
Because there are 2 types of architectures (architecture by uname command and actual architecture such as used in a part of a deb or a RPM package name), though I do not understand it well.
Same CPU type's 32-bit binary can work on the 64-bit host environment.

When you want to run fedora i386 image, unfortunately it does not exist on both DockerHub and official container repo.
https://hub.docker.com/_/fedora
https://registry.fedoraproject.org/repo/fedora/tags/

@junaruga
Copy link
Member

junaruga commented Aug 6, 2019

Debian, Alpine and CentOS has the i386 image too.
i386/debian : https://hub.docker.com/_/debian
i386/alpine : https://hub.docker.com/_/alpine
i386/centos : https://hub.docker.com/_/centos

If you just want to run 32-bit architecture's container, a Linux distribution's ARM-32 bit image can be the alternative of i386 such as arm32v7/fedora image: https://hub.docker.com/r/arm32v7/fedora/

@junaruga
Copy link
Member

junaruga commented Aug 6, 2019

Searched keywords: i386, i686, Intel 32-bit

@vk496
Copy link
Author

vk496 commented Aug 9, 2019

Thanks for your reply! I was interesting in compile native i386 code.

It was recently added with the docker/buildx#128 petition.

@vk496 vk496 closed this as completed Aug 9, 2019
@junaruga
Copy link
Member

junaruga commented Aug 9, 2019

Sure. Good news from docker buildx. I like it too. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants