Docker ports don't work in the provided yml

I’m using Jitsi via Docker.

The prosody configuration in docker-compose.yml starts like this:

    # XMPP server
    prosody:
        image: jitsi/prosody:${JITSI_IMAGE_VERSION:-stable-7882}
        restart: ${RESTART_POLICY:-unless-stopped}
        expose:
            - '${XMPP_PORT:-5222}'
            - '5347'
            - '5280'

However, when I start the containers, none of those ports are actually listening.

If I change the expose: part to this, it works:

        ports:
            - '${XMPP_PORT:-5222}:${XMPP_PORT:-5222}'
            - '5347:5347'
            - '5280:5280'

That’s intentional. Expose is defined as "Expose ports without publishing them to the host machine - they’ll only be accessible to linked services. "

Thanks. How should I use them? I was getting an error that Jitsi couldn’t connect, using expose.

What are you trying to do?

Just to host a server.

Then you don’t need that change.