Skip to content

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

@pocari

Description

@pocari
  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions