A published port, in docker compose short syntax: [HOST_IP:][HOST_PORT[-RANGE]:]CONTAINER_PORT[-RANGE][/PROTOCOL].
[HOST_IP:][HOST_PORT[-RANGE]:]CONTAINER_PORT[-RANGE][/PROTOCOL]
hostPort is optional: ports: ["3000"] publishes container port 3000 on a host port picked by docker, which is not the same as 3000:3000.
hostPort
ports: ["3000"]
3000:3000
Optional
Static
A published port, in docker compose short syntax:
[HOST_IP:][HOST_PORT[-RANGE]:]CONTAINER_PORT[-RANGE][/PROTOCOL].hostPortis optional:ports: ["3000"]publishes container port 3000 on a host port picked by docker, which is not the same as3000:3000.