docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
753 stars 85 forks source link

Cross-compiled Image Dies Suddenly When Starting Bash on ARM #131

Open mastermindg opened 6 years ago

mastermindg commented 6 years ago

Expected behavior

On a Raspberry Pi 3 running Docker 17.05.0-ce, build 89658be. I've cross-compiled an image on Docker Hub. I pull the image from Docker Hub and attempt to start up bash on the image:

docker pull mastermindg/gdrive_sync:arm
docker run -it --rm -v $PWD:/root mastermindg/gdrive_sync:arm bash
root@58d416aa8a43:~#

Actual behavior

On a Raspberry Pi 3 running Docker 17.05.0-ce, build 89658be. I've cross-compiled an image on Docker Hub. I pull the image from Docker Hub and attempt to start up bash on the image:

docker pull mastermindg/gdrive_sync:arm
docker run -it --rm -v $PWD:/root mastermindg/gdrive_sync:arm bash

The container immediately dies without any error. I've tried naming it and not removing it with the same result.

Steps to reproduce the behavior

docker pull mastermindg/gdrive_sync:arm
docker run -it --rm -v $PWD:/root mastermindg/gdrive_sync:arm bash

Output of docker version:

17.05.0-ce, build 89658be

Output of docker info:

Containers: 3
 Running: 0
 Paused: 0
 Stopped: 3
Images: 138
Server Version: 17.05.0-ce
Storage Driver: overlay
 Backing Filesystem: extfs
 Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Kernel Version: 4.4.50-hypriotos-v7+
Operating System: Raspbian GNU/Linux 8 (jessie)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 861.9MiB
Name: pi3
ID: DA3F:PQJK:XO2X:F3J4:7FXU:LRGD:RTLX:DQ72:NBUU:N37L:MPXV:PHU3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.)

Physical system - Raspberry Pi 3 Linux pi3 4.4.50-hypriotos-v7+ #1 SMP PREEMPT armv7l GNU/Linux

thaJeztah commented 6 years ago

Are you still seeing this on docker 17.10? Also, what does docker image inspect --format '{{.Architecture}}' <your image> show for the image you built?

mastermindg commented 6 years ago

Installing 17.10 on Raspbian took me a while. I had to uninstall docker-engine and install docker-ce to get to 17.10. Unfortunately I'm still having the same issue. I suspect it's something to do with the cross-build but I don't know where to start to debug this.

$ docker image inspect --format '{{.Architecture}}' gdrive_sync
arm
thaJeztah commented 6 years ago

hm, no direct suggestions; other images work as expected?

mastermindg commented 6 years ago

If i build the image locally it works as expected. The only difference between the local build and the Docker Hub build is cross-compiling.

thaJeztah commented 6 years ago

The cross-compile is done outside of a container? Is it dynamically linked?

(Also, reason I wanted to check the .Architecture output is that the image may get the architecture of the host it was built on, not the architecture of the binary inside the image if you're cross-compiling, in which case docker may not run the image when pulling)

friism commented 6 years ago

How are you cross-compiling on Docker Hub? Docker Hub only supports x86 afaik, although there are hacks you try: https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/

mastermindg commented 6 years ago

Right...I'm using the "hacks" on resin.io.