Why I can't to connect to aerospike?

I want to create docker with aerospike.
I have yaml:

  aerospike:
    image: aerospike/aerospike-server
    container_name: aerospike
    network_mode: host

Using network_mode is necessarily in this case. I started container and try check connection using command:

docker exec -it aerospike asinfo -h localhost -p 9876 -v status

I get

ERROR: Not able to connect any cluster with ('localhost', 9876, None)

In docker I get next logs:

link eth0 state up
link eth0 state up in 0
Dec 30 2021 11:10:41 GMT: INFO (as): (as.c:310) <><><><><><><><><><>  Aerospike Community Edition build 5.7.0.9  <><><><><><><><><><>
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) # Aerospike database configuration file.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) # This stanza must come first.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) service {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     user root
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     group root
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     pidfile /var/run/aerospike/asd.pid
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     service-threads 4
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     proto-fd-max 15000
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) logging {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     # Log file must be an absolute path.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     file /var/log/aerospike/aerospike.log {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         context any info
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     # Send log messages to stdout
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     console {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         context any info
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) network {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     service {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         address any
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         port 9876
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # Uncomment the following to set the `access-address` parameter to the
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # IP address of the Docker host. This will the allow the server to correctly
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # publish the address which applications and other nodes in the cluster to
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # use when addressing this node.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # access-address <IPADDR>
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     heartbeat {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # mesh is used for environments that do not support multicast
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         mode mesh
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         port 3002
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # use asinfo -v 'tip:host=<ADDR>;port=3002' to inform cluster of
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         # other mesh nodes
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         interval 150
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         timeout 10
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     fabric {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         port 3001
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     info {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         port 3003
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) namespace dsp {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     replication-factor 2
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     memory-size 1G
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     allow-ttl-without-nsup true
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     default-ttl 5d # 5 days, use 0 to never expire/evict.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     #    storage-engine memory
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) 
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     # To use file storage backing, comment out the line above and use the
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     # following lines instead.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     storage-engine device {
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         file /opt/aerospike/data/dsp.dat
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         filesize 4G
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)         data-in-memory true # Store data in memory in addition to file.
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041)     }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4041) }
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4073) system file descriptor limit: 1048576, proto-fd-max: 15000
Dec 30 2021 11:10:41 GMT: INFO (hardware): (hardware.c:1943) detected 8 CPU(s), 4 core(s), 1 NUMA node(s)
Dec 30 2021 11:10:41 GMT: INFO (socket): (socket.c:2700) Node port 3001, node ID bb917ebec7e3dd4
Dec 30 2021 11:10:41 GMT: INFO (config): (cfg.c:4105) node-id bb917ebec7e3dd4
Dec 30 2021 11:10:41 GMT: WARNING (os): (os.c:240) failed min-free-kbytes check - min_free_kbytes should be at least 1150976
Dec 30 2021 11:10:41 GMT: WARNING (config): (cfg.c:5117) failed service-threads check - 'service-threads' should be at least 8
Dec 30 2021 11:10:41 GMT: WARNING (config): (cfg.c:4489) failed best-practices checks - see 'https://docs.aerospike.com/docs/operations/install/linux/bestpractices/index.html'
Dec 30 2021 11:10:41 GMT: INFO (smd): (smd.c:2319) no file '/opt/aerospike/smd/evict.smd' - starting empty
Dec 30 2021 11:10:41 GMT: INFO (namespace): (namespace_ce.c:88) {dsp} beginning cold start
Dec 30 2021 11:10:41 GMT: INFO (smd): (smd.c:2319) no file '/opt/aerospike/smd/sindex.smd' - starting empty
Dec 30 2021 11:10:41 GMT: INFO (smd): (smd.c:2319) no file '/opt/aerospike/smd/truncate.smd' - starting empty
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:3405) opened file /opt/aerospike/data/dsp.dat: usable size 4294967296
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:1049) /opt/aerospike/data/dsp.dat has 4096 wblocks of size 1048576
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:3026) {dsp} found all 1 devices fresh, initializing to random 408432002086045309
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:1016) {dsp} loading free & defrag queues
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:953) /opt/aerospike/data/dsp.dat init defrag profile: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:1038) /opt/aerospike/data/dsp.dat init wblocks: pristine-id 8 pristine 4088 free-q 0, defrag-q 0
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:2111) {dsp} starting device maintenance threads
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:1473) {dsp} starting write threads
Dec 30 2021 11:10:41 GMT: INFO (drv_ssd): (drv_ssd.c:873) {dsp} starting defrag threads
Dec 30 2021 11:10:41 GMT: INFO (as): (as.c:379) initializing services...
Dec 30 2021 11:10:41 GMT: INFO (service): (service.c:168) starting 4 service threads
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:792) updated fabric published address list to {144.76.152.108:3001,10.0.6.2:3001,172.17.0.1:3001,192.168.0.1:3001,192.168.32.1:3001,172.27.0.1:3001,172.21.0.1:3001}
Dec 30 2021 11:10:41 GMT: INFO (partition): (partition_balance.c:202) {dsp} 4096 partitions: found 4096 absent, 0 stored
Dec 30 2021 11:10:41 GMT: INFO (hb): (hb.c:5518) updated heartbeat published address list to {144.76.152.108:3002,10.0.6.2:3002,172.17.0.1:3002,192.168.0.1:3002,192.168.32.1:3002,172.27.0.1:3002,172.21.0.1:3002}
Dec 30 2021 11:10:41 GMT: INFO (smd): (smd.c:2319) no file '/opt/aerospike/smd/UDF.smd' - starting empty
Dec 30 2021 11:10:41 GMT: INFO (batch): (batch.c:781) starting 8 batch-index-threads
Dec 30 2021 11:10:41 GMT: INFO (health): (health.c:318) starting health monitor thread
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:417) starting 8 fabric send threads
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:431) starting 16 fabric rw channel recv threads
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:431) starting 4 fabric ctrl channel recv threads
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:431) starting 4 fabric bulk channel recv threads
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:431) starting 4 fabric meta channel recv threads
Dec 30 2021 11:10:41 GMT: INFO (fabric): (fabric.c:443) starting fabric accept thread
Dec 30 2021 11:10:41 GMT: WARNING (socket): (socket.c:777) Socket 0.0.0.0:3001 in use, waiting
Dec 30 2021 11:10:41 GMT: INFO (hb): (hb.c:6974) initializing mesh heartbeat socket: 0.0.0.0:3002
Dec 30 2021 11:10:41 GMT: WARNING (socket): (socket.c:777) Socket 0.0.0.0:3002 in use, waiting
Dec 30 2021 11:10:46 GMT: WARNING (socket): (socket.c:777) Socket 0.0.0.0:3001 in use, waiting
Dec 30 2021 11:10:46 GMT: WARNING (socket): (socket.c:777) Socket 0.0.0.0:3002 in use, waiting
Dec 30 2021 11:10:51 GMT: WARNING (socket): (socket.c:777) Socket 0.0.0.0:3001 in use, waiting
Dec 30 2021 11:10:51 GMT: WARNING (socket): (socket.c:777) Socket 0.0.0.0:3002 in use, waiting

and this doesn’t look like healthy container.
Please, couldn’t you tell me, where is my mistake?

Proper network should be configured for both

  1. run aerospike server with network mode host like in your docker compose file
  2. and then to connect to it for docker run use same network mode host as well, ie:
docker run -it --network host aerospike/aerospike-tools:latest asinfo -h 0 
docker run -it --network host aerospike/aerospike-tools:latest asadm -h 0
docker run -it --network host aerospike/aerospike-tools:latest aql -h 0

Note instead of 0 you can use 0.0.0.0 or localhost