docker / for-mac

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

Negative port number #7298

Open idant1111 opened 6 months ago

idant1111 commented 6 months ago

Description

Noticed while creating a new container - not sure if on purpose - A negative value is possible to enter in the Port's "Host port" field

image

Reproduce

  1. open docker desktop GUI
  2. run a new container from image
  3. press down-arrow / click down on "Host port" nav key down

Expected behavior

provide a warning message or redirect to a default port number

docker version

Client:
 Cloud integration: v1.0.29
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:41 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.16.2 (95914)
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:25:43 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.0)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.0.5)
  extension: Manages Docker extensions (Docker Inc., v0.2.17)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.23.0)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 2
 Server Version: 20.10.22
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  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 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.668GiB
 Name: docker-desktop
 ID: X63K:EFHJ:LXZU:ZW5A:32X7:LFDI:5P26:LJJK:5A24:BIPJ:F3BM:JG2N
 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
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Diagnostics ID

F8B026D9-4CD1-409B-B75D-A3D8EA1A4030/20240528190038

Additional Info

No response

voonyee commented 6 months ago

hi, thanks for reporting this.

Upon checking, we noticed that your Docker Desktop version (4.16.2) is not updated to date.

Please try the latest version (4.30.0) and see if you are still experiencing the same issue. https://docs.docker.com/desktop/release-notes/#4300

idant1111 commented 6 months ago

@voonyee thank you for your response After updating to latest (4.30.0) The "arrow down" was solved, and I can't go lower from 0- But it could still occur when inserting a dash (-) into the port field (i.e. -5)

image

I'm not sure if it's on purpose - but there's a limit of 2 dashes (i.e. --)

Docker responded with 400

image

I propose that the filed input should be positive integer only

this also occurs : the argument --e (which I think is also on purpose)

image

It allows the container to be built after hitting "Run"