Aerospike docker connection refused using docker servicename

I am trying to use aerospike docker container , with python application also running same docker network. Below is the docker compose file.

aerospike:
    image: aerospike/aerospike-server
    volumes: 
      - "./aerospikeconfig:/opt/aerospike/etc"
    environment: 
      config-file: /opt/aerospike/etc/aerospike.conf

  rtbconsumer:
    image: abhinav054/rtb_consumer:trending
    depends_on: 
      - aerospike
      - kafka
    environment: 
      CONSUMER_ID: "rtb_aerospike_2"
      HOST: "kafka:9092"
      TOPIC: "rtb-logs"
      AEROSPIKE_HOST: "aerospike:3000"

So in my script I am connecting aerospike using the below given config

config = { 
      'hosts':[('aerospike', 3000)],
      'policies': {
        'timeout': 1000 # milliseconds
      }
    }

The error I am getting is exception.ConnectionError: (-10, ‘Failed to connect’, ‘src/main/aerospike/as_cluster.c’, 254, False)

Can someone please help me figure out the problem.

Hi,

What command are you using to create Aerospike container. I assume this is community version. How are you mapping that port 3000 to host please. Can you please do

docker inspect name

where ‘name’ is the name you used to create the container.

HTH