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

In docker desktop preview, the inotify function fails on a container with platform set to linux/amd64. #5321

Closed
2 of 3 tasks
pocari opened this issue Feb 8, 2021 · 7 comments

Comments

@pocari
Copy link

pocari commented Feb 8, 2021

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
    (Experimental features is disabled and docker for mac(preview) does not start, so I left it enabled.)
  • I have uploaded Diagnostics
  • Diagnostics ID: 98CB408F-BEC7-4476-A23F-BD558734719F/20210208080717

Expected behavior

The inotify_init function will succeed.

Actual behavior

The inotify_init function failed.

Information

  • macOS Version:

スクリーンショット 2021-02-08 16 44 59

  • docker for mac version:

スクリーンショット 2021-02-08 16 35 44

  • docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., unknown)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.3.5)

Server:
 Containers: 26
  Running: 0
  Paused: 0
  Stopped: 26
 Images: 56
 Server Version: 20.10.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 1.935GiB
 Name: docker-desktop
 ID: BOLF:IFEL:Q3SV:YV5Y:SRFP:QBMC:FPB6:N3UF:QCFD:OIAC:ADDU:3WRZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Steps to reproduce the behavior

This is the main.c that appears in the following reproduction procedure.

#include <stdio.h>
#include <sys/inotify.h>

int main(void) {
  int ret = inotify_init();
  if (ret < 0) {
    fprintf(stderr, "error: inotify_init returns %d\n", ret);
    return 1;
  }
  fprintf(stderr, "success: inotify_init returns %d\n", ret);
  return 0;
}
  • In the case of a container started with Linux/arm64 as platform (default for M1)

inotify_init succeeds.

% docker run --rm -it -v $(pwd):/test --platform linux/arm64 buildpack-deps:latest bash

Unable to find image 'buildpack-deps:latest' locally
latest: Pulling from library/buildpack-deps
Digest: sha256:782de14b2481856bb30181ef6c1987ddc550579fcf0dae94403c66791095b455
Status: Downloaded newer image for buildpack-deps:latest
root@d26a08af3ca9:/# cd /test
root@d26a08af3ca9:/test# gcc main.c
root@d26a08af3ca9:/test# file a.out
a.out: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=3d667ef61aec5a9b4d1d1dc46d3c4cbdccd6dad8, not stripped
root@d26a08af3ca9:/test# ./a.out
success: inotify_init returns 3
  • In the case of a container started with Linux/amd64 as platform

inotify_init will fail.

% docker run --rm -it -v $(pwd):/test --platform linux/amd64 buildpack-deps:latest bash

Unable to find image 'buildpack-deps:latest' locally
latest: Pulling from library/buildpack-deps
Digest: sha256:782de14b2481856bb30181ef6c1987ddc550579fcf0dae94403c66791095b455
Status: Downloaded newer image for buildpack-deps:latest
root@14ddab183202:/# uname -a
Linux 14ddab183202 4.19.104-linuxkit #1 SMP PREEMPT Sat Feb 15 00:49:47 UTC 2020 x86_64 GNU/Linux
root@14ddab183202:/# cd /test
root@14ddab183202:/test# gcc main.c
root@14ddab183202:/test# file a.out
a.out: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=6269a33e8bd0d2d0e7a489940e2ea93fe81d92b7, not stripped
root@14ddab183202:/test# ./a.out
error: inotify_init returns -1

@stephen-turner stephen-turner added the area/m1 M1 preview builds label Feb 8, 2021
@djs55
Copy link
Contributor

djs55 commented Feb 12, 2021

@pocari thanks for the report and the reproduction steps. I confirm that it reproduces for me on the build 3.1.0 (60984). I presume it must be a limitation of qemu used for binary emulation. I'll add this to our backlog for investigation.

@DavidSporer
Copy link

I guess this was expected since this is still open but this error can still be reproduced with RC1 (Version 3.3.0).

@megui88
Copy link

megui88 commented Apr 5, 2021

The problem persist in RC3 (Version 3.3.0).

@jonareyes
Copy link

Anybody find any solution for this issue, I don't find anything to fix o have a temporary solution?

@Zenexer
Copy link

Zenexer commented Apr 20, 2021

@jonareyes The current workaround is to switch to ARM64 images and avoid x86 images. According to the Docker docs (which link to this very issue), inotify doesn't work when emulating x86.

@djs55
Copy link
Contributor

djs55 commented Apr 21, 2021

@Zenexer is exactly right -- the only solution is to switch to arm64-capable multi-arch images. These will also be a lot faster and generally more reliable. I recommend investigating which base images you're using and to switch to multi-arch ones where possible. You can see which architectures are supported by each image on Docker Hub:

image

To build a multi-arch image yourself, I recommend docker buildx, check out this blog post: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

Since this is a qemu limitation rather than a Docker bug, I'll close this issue for now. You're welcome to keep discussing the topic though.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators May 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants