docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 117 forks source link

Can't run Ubuntu-based image on MacOSX #7007

Open ericvergnaud opened 1 year ago

ericvergnaud commented 1 year ago

Description

When running a container whose image is based on Ubuntu, the container exits almost immediately, without an error message

Reproduce

  1. docker image pull ubuntu:22.04
  2. docker create ubuntu:22.04
  3. docker container list -> the list is empty Open docker desktop, the container has been created but is stopped Click on the "Start" button, it starts and then stops immediately

Expected behavior

The container should run

docker version

Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:28:49 2023
 OS/Arch:           darwin/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.24.0 (122432)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:16 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    24.0.6
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.5
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.22.0-desktop.2
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.8
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.7
    Path:     /Users/ericvergnaud/.docker/cli-plugins/docker-scout

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 1
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 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 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.4.16-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 17
 Total Memory: 7.768GiB
 Name: docker-desktop
 ID: a38b5534-34f8-4680-b2b8-ee1dc2e2c98a
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

Diagnostics ID

B7B03FAA-10FA-4822-9C79-4698246047CA/20231003004344

Additional Info

Works fine with docker desktop 3.6 Works fine with debian image (for example postgres:12.16)

dgageot commented 10 months ago

Hi @ericvergnaud, what you are describing is the normal behaviour of docker create. It'll create a container but not run it: https://docs.docker.com/engine/reference/commandline/create/

ericvergnaud commented 10 months ago

Hi, thanks for the feedback, but as described in the bug report, to reproduce you need to Click on the "Start" button, it starts and then stops immediately That's the abnormal behavior. Any attempt to actually run the container fails similarly.

dgageot commented 10 months ago

Sorry @ericvergnaud, I missed that part. This is also expected.

When you run docker create postgres:12.16 and then click "Start", it'll start a non-interactive process which is the database itself. This will run in the background and therefore, you'll see the container being up and running.

When you run docker create ubuntu and then click "Start", you start ubuntu image's default entrypoint, which is /bin/bash in a non-interactive mode. Because it's not interactive, it'll exit a few milliseconds after it's started.

One way to make the container survive is to create the container in interactive mode. E.g. with docker create -it ubuntu.

Hope this makes it clearer.

ericvergnaud commented 10 months ago

Thanks for the clear explanation, I'll try that. What's strange though is that the same container runs perfectly with docker 3.6. Was this behavior introduced later ?

dgageot commented 10 months ago

Thanks for the clear explanation, I'll try that. What's strange though is that the same container runs perfectly with docker 3.6. Was this behavior introduced later ?

The GUI has changed a lot since 3.6. Maybe it did behave differently. Now the GUI behaves exactly like the CLI would.

sestok commented 6 months ago

@dgageot

Thanks for the info. This has also worked for me

docker container run -d -it --name ubuntu --rm ubuntu