docker compose change the name of your container hostname
you just want to change the name of your container. In docker-compose, you can do this by setting the “container_name” property on any of your containers.
For example:
db:
image: mysql:5.7
container_name: db
If you don’t want to change the container name, but needs ‘user-friendly’ names for discovery, you can as well set the ‘hostname’ property, or you can add network aliases, like such:
db:
image: mysql:5.7
container_name: mycontainername
hostname: myhostname
networks:
default:
aliases:
myalias