What shall I give the ip adress of redis container to which tomcat will connect through source code Docker volume

I am a beginner in docker.
My source code has a properties file inside xyz volume where I have to mention redis ip address and password. Here tomcat is unable to connect to redis
This is my docker-compose.yml

version: "2"

services:
    tomcat:
      container_name: tomcat
      build: ./tomcat
      ports:
       - "8080:8080"
      env_file:
       - ./tomcat/tomcat.env
      networks:
       - srikant-network
      environment:
       - COMPOSE_HTTP_TIMEOUT=200
      volumes:
       - /opt/xyz:/opt/xyz
      depends_on:
       - redis
       - mysql
       - elasticsearch

    redis:
      container_name: redis
      build: ./redis
      ports:
       - "6379"
      environment:
         requirepass: password
      networks:
       - srikant-network

    elasticsearch:
      container_name: elasticsearch
      build: ./elasticsearch
      ports:
       - "9300:9300"
       - "9200:9200"
      networks:
       - srikant-network
    mysql:
      container_name: mysql
      build: ./mysql
      ports:
       - "3306:3306"
      networks:
       - srikant-network
      environment:
       - MYSQL_ROOT_PASSWORD=password
       - MYSQL_HOST=localhost
networks:
    srikant-network:
      driver: bridge

This is version of docker and docker-compose:

  • Best practices for using docker in an air-gapped environment
  • Access docker-machine containers from external network
  • Custom fonts in rrdgraph in a Docker container running Alpine Linux
  • start redis-server on debian/ubuntu boot
  • Restore database state after integration test using Docker?
  • Bridged network connection in Dockerfile
  • [root@sqlnode1 ha]# docker version
    Client:
     Version:         1.12.6
     API version:     1.24
     Package version: docker-1.12.6-28.git1398f24.el7.centos.x86_64
     Go version:      go1.7.4
     Git commit:      1398f24/1.12.6
     Built:           Fri May 26 17:28:18 2017
     OS/Arch:         linux/amd64
    
    Server:
     Version:         1.12.6
     API version:     1.24
     Package version: docker-1.12.6-28.git1398f24.el7.centos.x86_64
     Go version:      go1.7.4
     Git commit:      1398f24/1.12.6
     Built:           Fri May 26 17:28:18 2017
     OS/Arch:         linux/amd64
    
    
    [root@sqlnode1 ha]# docker-compose version
    docker-compose version 1.13.0, build 1719ceb
    docker-py version: 2.3.0
    CPython version: 2.7.5
    OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
    

    This is the Dockerfile of redis

    FROM ubuntu:14.04
    
    RUN apt-get update && apt-get install -y redis-server
    
    EXPOSE 6379
    ENV requirepass redis-password
    
    ENTRYPOINT ["/usr/bin/redis-server"]
    

  • View Tensorboard on Docker on Google Cloud
  • How to check whether python package is installed or not in Docker?
  • Multiple NIC and Docker containers
  • How to make volume as optional, so if I not required mount db so disable volume using flag
  • Flask-WTF CSRF token error when on Docker
  • How can I pass secret data to a container
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.