Hostname with public IP in docker compose

Hello

Anybody, have an idea about how to differentiate between hostname and public IP in docker-compose file.?

I want to create container with hostname ex : gilab-ce.com as hostname to access but on public IP .

how to implement in docker compose file .?

Thank you

This is the job of a reverse proxy, like Traefik, nginx, caddy or haproxy. It will also handle https TLS encryption.

Check simple Traefik example or nginx-proxy example.

Just to be sure: setting up the DNS a-record that resolves to the public ip needs to be done where ever you administrate the DNS hosted zone. This has nothing to do with docker.