Aerospike docker connection refused using docker servicename Aerospike docker connection refused using docker servicename docker docker

Aerospike docker connection refused using docker servicename


In response to your question, which should also solve your problem:

@QuintenScheppermans ain't the default network bridge, I am a bit rusty on the networking. Can you send some sample.

Yes, containers are automatically added to a default bridge network. However, Docker does not support automatic service discovery on the default bridge network. If you want containers to be able to resolve IP addresses by container name, you should use user-defined networks instead.

This is exactly what you're doing here:

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

So you do need to configure a user-defined network.Bridge networks are recommended for single host networks (like in your case)Overlay networks are recommended for multiple host networks.

You can use Ivolmar's answer and switch it to a bridge network.You don't need to use docker swarm if you don't want that.


You could try creating an overlay network in your docker-compose and adjust your aerospike.conf interface address bindings accordingly.Aerospike repo has an example using docker swam.

  aerospike:    image: aerospike/aerospike-server    volumes:       - "./aerospikeconfig:/opt/aerospike/etc"    environment:       config-file: /opt/aerospike/etc/aerospike.conf    networks:      - aerospikenet  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"    networks:      - aerospikenetnetworks:    aerospikenet:        driver: overlay  #used on multiple host configurations       #driver: bridge   #used on single host configuration        attachable: true