Docker Community Forums

Share and learn in the Docker community.

Host ip in docker-compose.yml


(Ducatel David) #1

Hi all,

I’m trying to create a cluster of redis database.
For that I need to use a redis sentinel with a redis DB.
So my docker-compose

redis:
    image: redis
    ports: 
        - "6379:6379"
    volumes:
        - /home/redis-data:/data

sentinel:
    build: . # my Dockerfile here create the /etc/redis/sentinel.conf file
    links: 
        - redis:redis_link
    ports:
        - "26379:26379"
    command: redis-sentinel /etc/redis/sentinel.conf --sentinel announce-ip 1.2.3.4 # here I want the HOST_IP

According to the redis documentation http://redis.io/topics/sentinel (part Sentinel, Docker, NAT, and possible issues), I need to use the host IP with the parameter ‘annouce-ip’.

But this is my problem. How I can pass/use the host IP in my docker-compose file ?
This is possible ?

Thank for your help