Is --hostname
like a domain name system in docker container environment that can replace --ip
when referring to other container?
If you need to change the hostname in a way that other containers from the same network will see it, just use --net-alias=${MY_NEW_DNS_NAME}
For example:
docker run -d --net-alias=${MY_NEW_DNS_NAME} --net=my-test-env --name=my-docker-name-test
Please see: Difference between --link and --alias in overlay docker network?