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

[BUG] config command shows published ports as strings #10538

Closed
rollsover opened this issue May 8, 2023 · 4 comments
Closed

[BUG] config command shows published ports as strings #10538

rollsover opened this issue May 8, 2023 · 4 comments

Comments

@rollsover
Copy link

Description

It was noticed earlier, but now the version is new

Here is an old problem #9306

Steps To Reproduce

  1. Make docker-compose.yml file
services:
  nginx:
    image: nginx
    ports:
      - published: 80
        target: 80
        mode: host
  1. Run docker compose config
name: test
services:
  nginx:
    image: nginx
    networks:
      default: null
    ports:
    - mode: host
      target: 80
      published: "80"
networks:
  default:
    name: test_default

Compose Version

Docker Compose version v2.17.3

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     /Users/glebstorozhenko/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.3
    Path:     /Users/glebstorozhenko/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/glebstorozhenko/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     /Users/glebstorozhenko/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     /Users/glebstorozhenko/.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/glebstorozhenko/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/glebstorozhenko/.docker/cli-plugins/docker-scan
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.10.0
    Path:     /Users/glebstorozhenko/.docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 223
 Server Version: 23.0.5
 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: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 6
 Total Memory: 9.717GiB
 Name: docker-desktop
 ID: 92809fa0-a2de-4abf-a150-c1afe6dd14af
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 36
  Goroutines: 51
  System Time: 2023-05-08T16:02:36.36701163Z
  EventsListeners: 8
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Experimental: true
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

@ndeloof
Copy link
Contributor

ndeloof commented May 9, 2023

Have you read comments on #9306 ?
This is the expected behavior. published port can be set as a range in a port definition, so the canonical type for this attribute is string.

@rollsover
Copy link
Author

@ndeloof When saving the configuration for further use in swarm, we get an error that the port must be int

@ndeloof
Copy link
Contributor

ndeloof commented May 10, 2023

Swarm doesn't support the compose specification, and so can't consume docker compose output. See docker/cli#2527

Why don't you directly use your compose file with docker stack deploy and require this to be processed by docker compose config ?

@ndeloof ndeloof closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2023
@rollsover
Copy link
Author

@ndeloof because needs prepare file (remove nulls, .name key, convert depends with condition to depends as list), and i have multifiles compose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants