dotnet / dotnet-docker

Docker images for .NET and the .NET Tools.
https://hub.docker.com/_/microsoft-dotnet
MIT License
4.49k stars 1.94k forks source link

Allow building images derived from the ARM dotnet images on x86-based machines #276

Closed TAGC closed 7 years ago

TAGC commented 7 years ago

This builds on #223, which is now done. If possible, I'd like to be able to create images derived from the dotnet Docker images targeting ARM containing modifications such as additional installed packages.

Looking into it, I think this might be possible using a system emulation tool like QEMU.

Steps to reproduce the issue

On an x86-based machine, like one running Windows 7:

  1. Create a dockerfile with the following content:
    FROM microsoft/dotnet-nightly:2-runtime-stretch-arm32v7
    RUN apt-get update
  2. Try building it: docker build . -t example

Expected behavior

The image builds without error, and I can see an image tagged as example:latest when I run docker images.

Actual behavior

The build fails on the first RUN command with standard_init_linux.go:178: exec user process caused "exec format error".

Additional information (e.g. issue happens only occasionally)

$ docker build . -t example
Sending build context to Docker daemon  87.81MB
Step 1/2 : FROM microsoft/dotnet-nightly:2-runtime-stretch-arm32v7
2-runtime-stretch-arm32v7: Pulling from microsoft/dotnet-nightly
ed4f1f0d0a04: Already exists
b89ca1897f8a: Pulling fs layer
6dfbc0b21d92: Pulling fs layer
b90d21b2c65d: Pulling fs layer
6dfbc0b21d92: Verifying Checksum
6dfbc0b21d92: Download complete
b90d21b2c65d: Verifying Checksum
b90d21b2c65d: Download complete
b89ca1897f8a: Verifying Checksum
b89ca1897f8a: Download complete
b89ca1897f8a: Pull complete
6dfbc0b21d92: Pull complete
b90d21b2c65d: Pull complete
Digest: sha256:905e4468d8fbf222ceea979f01f14fd5b946038d7da7ca046ee08fa781572f3d
Status: Downloaded newer image for microsoft/dotnet-nightly:2-runtime-stretch-arm32v7
 ---> 71e6df18820e
Step 2/2 : RUN apt-get update
 ---> Running in e9fb6e709a51
standard_init_linux.go:178: exec user process caused "exec format error"
The command '/bin/sh -c apt-get update' returned a non-zero code: 1

Output of docker version

Client:
 Version:      17.06.0-ce
 API version:  1.26 (downgraded from 1.30)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:30:30 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   3a232c8
 Built:        Tue Feb 28 07:52:04 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info

Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 117
Server Version: 17.03.0-ce
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 195
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log:
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 977c511eda0925a723debdc94d09459af49d082a
runc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.4.52-boot2docker
Operating System: Boot2Docker 17.03.0-ce (TCL 7.2); HEAD : f11a204 - Thu Mar  2 00:14:47 UTC 2017
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.858GiB
Name: default
ID: 2VPH:YQTZ:RABN:GCZJ:YPZO:326N:G6GE:MBAM:3X7Y:WHQN:4X7G:435E
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 15
 Goroutines: 23
 System Time: 2017-08-14T07:40:09.609955745Z
 EventsListeners: 0
Username: <redacted>
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
MichaelSimons commented 7 years ago

Are you able to build and run your image based on arm32v7/debian:stretch in your environment?

FROM arm32v7/debian:stretch
RUN apt-get update

Your issue doesn't seem to be specific to the microsoft/dotnet images.

TAGC commented 7 years ago

No, that fails in the same way as expected. It's not specific to microsoft/dotnet, I was just hoping they'd provide a way to simplify deployment of .NET Core applications targeting ARM devices from x86-based machines like most people use. I imagine this would be even more necessary for the SDK images when work starts on them.

I can understand if this isn't something that Microsoft wants to focus on. In that case, this issue can be closed and I'll try to find a workaround.

MichaelSimons commented 7 years ago

It looks like you are using Docker Toolbox because you are on Windows 7. I'm not sure this is what "most people use". Docker considers this a "Legacy desktop solution" and recommends upgrading. I think you will find that using a Window 10 machine will provide the experience you are looking for. You will be able to build and run arm32v7 images.

TAGC commented 7 years ago

Ah okay, I'll hold off on this until I upgrade to Windows 10.

MichaelSimons commented 7 years ago

Once you upgrade, if you encounter issues feel free to open a new issue. Closing issue.