[BUG] docker compose publish rejects short-form port mapping
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 38.2k
- Forks
- 5.8k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 55
Description
Description
Running docker compose publish fails when a service uses the short-form port
syntax:
ports:
- ${DASHBOARD_PORT:-3000}:3000
Error:
'services[whoami].ports[0]' expected a map or struct, got "string"
The short-form syntax is valid per the Compose spec
and works with docker compose up.
The OCI artifact encoder/decoder requires the long form:
ports:
- target: 3000
published: "${DASHBOARD_PORT:-3000}"
Steps To Reproduce
- Create the file:
cat > compose.yaml <<'EOF'
services:
whoami:
image: docker.io/traefik/whoami:v1.11
ports:
- ${DASHBOARD_PORT:-3000}:3000
EOF
- Publish:
docker compose publish <registry>/<image>:<tag>
Compose Version
$ docker-compose version
Command 'docker-compose' not found, but can be installed with:
sudo snap install docker # version 28.4.0, or
sudo apt install docker-compose # version 1.29.2-6
See 'snap info docker' for additional versions.
$ docker compose version
Docker Compose version v5.1.0
Docker Environment
$ docker info
Client: Docker Engine - Community
Version: 29.3.0
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.31.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v5.1.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 119
Server Version: 4.9.3
Storage Driver: overlay
Supports d_type: true
Native Overlay Diff: true
Using metacopy: false
Supports shifting: false
Supports volatile: true
Backing Filesystem: extfs
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge macvlan ipvlan
Log: k8s-file none passthrough journald
Swarm: inactive
Runtimes: crun ocijail runsc crun-wasm kata krun runc runj youki
Default Runtime: crun
Init Binary:
containerd version:
runc version:
init version:
Security Options:
seccomp
Profile: default
rootless
Kernel Version: 6.6.87.2-microsoft-standard-WSL2
Operating System: ubuntu
OSType: linux
Architecture: amd64
CPUs: 8
Total Memory: 7.557GiB
Name: DENEC1
ID: 22893162-076d-4bf1-b265-666029302de0
Docker Root Dir: /home/karna/.local/share/containers/storage
Debug Mode: false
Experimental: true
Live Restore Enabled: false
Product License: Apache-2.0
Anything else?
I'm using podman with docker-compose-plugin. Docker Engine is not installed.
Docker CLI use podman thanks to export DOCKER_HOST="unix://${XDG_RUNTIME_DIR}podman/podman.sock"
I don't think it change anything but for transparentsy.
I have used an AWS ECS for my test.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported docker compose publish command with the short-form ports entry, then trace the publish path into the OCI artifact encoder/decoder described in the issue. No files or tests are named, so locate the relevant port conversion and its existing long-form handling; done means the short-form mapping publishes successfully without breaking long-form ports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, go
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100