multiarch / qemu-user-static

:earth_africa: `/usr/bin/qemu-*-static`
https://hub.docker.com/r/multiarch/qemu-user-static/
MIT License
2.42k stars 225 forks source link

Issue while installing docker inside s390x container under qemu #108

Open rajaskakodkar opened 4 years ago

rajaskakodkar commented 4 years ago

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

/kind bug

Description:

Not able to install docker inside s390x container under qemu on amd64

Steps to reproduce the issue:

  1. docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

  2. docker run --it --privileged s390x/ubuntu:18.04

  3. apt-get update

  4. apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common

  5. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

  6. add-apt-repository \ "deb [arch=s390x] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"

  7. apt-get update

  8. apt-get install -y --no-install-recommends docker-ce=18.06.*

Describe the results you received: These errors are seen while installing docker

invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.

docker does not come up after running service docker start

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Describe the results you expected: Docker is expected to come up after running service docker start

Environment:

Output of docker version

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:25:46 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 01:24:19 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Additional information optionally: I tried the following fixes before installing docker inside the s390x container but they didn't work.

printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d
export RUNLEVEL=1
junaruga commented 4 years ago

What is the host OS? Ubuntu?

I am not sure about the issue. https://stackoverflow.com/questions/44678725/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docker

The docker run --rm --privileged multiarch/qemu-user-static --reset -p yes installs the following files with flags: F.

If you can find it.

/proc/sys/fs/binfmt_misc/qemu-$arch

First you can try Travis arch: s390x, can you do the operation without QEMU in the environment?

Next you can try the following apt package. May it also overrides teh binfmt_misc files.

$ apt-get install -y binfmt-support

If still does not work, it might be QEMU issue. You can ask it on QEMU issue tracker showing your binfmt_misc file

/proc/sys/fs/binfmt_misc/qemu-s390x
rajaskakodkar commented 4 years ago

What is the host OS? Ubuntu?

Yes, Ubuntu 18.04

/proc/sys/fs/binfmt_misc/qemu-$arch

Contents of this file are

enabled
interpreter /usr/bin/qemu-s390x-static
flags: F
offset 0
magic 7f454c4602020100000000000000000000020016
mask ffffffffffffff00fffffffffffffffffffeffff

First you can try Travis arch: s390x, can you do the operation without QEMU in the environment?

I cannot do without QEMU in the environment

I have reported this bug on qemu issue tracker https://bugs.launchpad.net/qemu/+bug/1880518

junaruga commented 4 years ago

Contents of this file are

Sure, this is expected one.

I cannot do without QEMU in the environment

I meant if you use Travis CI's s390x native host feature, you can build and run your s390x Dockerfile container without QEMU, you can know the error by apt-get install -y --no-install-recommends docker-ce=18.06.* comes from QEMU or s390x architecture specific. You can see https://docs.travis-ci.com/user/multi-cpu-architectures/ for detail.

I have reported this bug on qemu issue tracker https://bugs.launchpad.net/qemu/+bug/1880518

Nice! Thank you for that.

rajaskakodkar commented 4 years ago

I meant if you use Travis CI's s390x native host feature, you can build and run your s390x Dockerfile container without QEMU, you can know the error by apt-get install -y --no-install-recommends docker-ce=18.06.* comes from QEMU or s390x architecture specific.

The error appears on s390x native container, but it does not stop docker from starting. docker in docker works flawlessly on s390x native host. Following trick worked to get docker service up on s390x container under QEMU.

printf '{"iptables": false,"ip-masq": false,"bridge": "none" }' > /etc/docker/daemon.json

but docker pull fails with this error

failed to register layer: Error processing tar file(exit status 1):

I have mentioned this in the bug reported on qemu issue tracker.

vitt-bagal commented 2 years ago

This is can be closed as corresponding qemu issue is closed