Skip to content

Conversation

@7-zete-7
Copy link
Contributor

Docker Compose has a special attribute port.name for naming ports. I suggest using this attribute instead of port comments.

See compose-spec/compose-spec#464

Copy link
Owner

@dunglas dunglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I suggest making the naming consistent with the one in the examples.

@7-zete-7
Copy link
Contributor Author

@dunglas Changed the port names to the suggested ones.

@dunglas dunglas merged commit e033f95 into dunglas:main Oct 13, 2025
1 of 2 checks passed
@dunglas
Copy link
Owner

dunglas commented Oct 13, 2025

Thanks!

@7-zete-7 7-zete-7 deleted the chore/port-name branch October 13, 2025 14:49
@philbates35
Copy link

Just an FYI, I'm running Ubuntu 24.04 LTS with docker installed from the default Ubuntu apt repos, and this PR broke all docker compose commands when creating a fresh symfony-docker project.

phil-bates@phil-bates-ThinkPad-X1-Carbon-Gen-11:~/code/philbates35/symfony-docker$ docker compose build --pull --no-cache
validating /home/phil-bates/code/philbates35/symfony-docker/compose.yaml: services.php.ports.0 Additional property name is not allowed
phil-bates@phil-bates-ThinkPad-X1-Carbon-Gen-11:~/code/philbates35/symfony-docker$ docker --version
Docker version 27.5.1, build 27.5.1-0ubuntu3~24.04.2
phil-bates@phil-bates-ThinkPad-X1-Carbon-Gen-11:~/code/philbates35/symfony-docker$ docker compose version
Docker Compose version 2.24.6+ds1-0ubuntu2

For anyone else that comes across this error, the solution is to manually revert the changes in this PR in compose.yaml:

    ports:
-     - name: http
-       target: 80
+     - target: 80
        published: ${HTTP_PORT:-80}
        protocol: tcp
-     - name: https
-       target: 443
+     - target: 443
        published: ${HTTPS_PORT:-443}
        protocol: tcp
-     - name: http3
-       target: 443
+     - target: 443
        published: ${HTTP3_PORT:-443}
        protocol: udp

Or alternatively, I guess you can switch your docker install to use the docker repos instead of the Ubuntu repos (not tried this myself).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants