-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
compose-spec/compose-go
#787Labels
Description
Description
When specifying an invalid IP address in the host_ip field of a services.*.ports entry, using the short form syntax causes docker compose to output an error, while in the long form syntax the invalid input is accepted.
Steps To Reproduce
Create file short.yaml:
name: host_ip_bug
services:
test:
image: alpine
ports:
- "notavalidip:1234:1234"Create file long.yaml:
name: host_ip_bug
services:
test:
image: alpine
ports:
- host_ip: "notavalidip"
target: 1234
published: "1234"Test config of short syntax:
docker compose -f short.yaml configOutput:
invalid IP address: notavalidip
Test config of long syntax:
docker compose -f long.yaml configOutput:
name: host_ip_bug
services:
test:
image: alpine
networks:
default: null
ports:
- mode: ingress
host_ip: notavalidip
target: 1234
published: "1234"
protocol: tcp
networks:
default:
name: host_ip_bug_defaultCompose Version
Docker Compose version 2.34.0
Docker Environment
Client: Docker Engine - Community
Version: 28.0.1
Context: colima
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.21.2
Path: /opt/homebrew/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.34.0
Path: /opt/homebrew/lib/docker/cli-plugins/docker-compose
Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 158
Server Version: 27.4.0
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 splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 88bf19b2105c8b17560993bee28a01ddc2f97182
runc version: v1.2.2-0-g7cb3632
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-50-generic
Operating System: Ubuntu 24.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.819GiB
Name: colima
ID: 4704f4f2-2d81-4813-9d80-7185e4efd631
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Default Address Pools:
Base: 100.64.0.0/16, Size: 24
Anything else?
No response