Docker Compose hostname command not working

Viewed 6417

I'm unable to get the Docker Compose hostname command to work.

I'm running a simple docker-compose.yml:

version: '3'
services:
  redis1:
    image: "redis:alpine"
    hostname: redis1host
  redis2:
    image: "redis:alpine"
    hostname: redis2host

Once I run this with docker-compose up, I should be able to run docker-compose exec redis1 /bin/ash and then ping redis2host to talk to the other Redis container, but the ping just doesn't reach its destination. I can ping the other Redis container with ping redis2.

ping redishost2 should work, no?

1 Answers
Related