amc,aerospike在docker容器内无法识别

时间:2017-12-03 13:15:53

标签: docker aerospike aerospike-loader

我已经停靠了ubuntu 16.04图片,并且我正在运行其中的aerospike服务器。

$ docker run -d -p 3000:3000 -p 3001:3001 -p 3002:3002 -p 3003:3003  -p 8081:8081  --name aerospike aerospike/aerospike-server

docker容器已成功运行。

$ docker ps
CONTAINER ID        IMAGE                        COMMAND                
CREATED             STATUS              PORTS                                                      
NAMES
b0b4c63d7e22        aerospike/aerospike-server   "/entrypoint.sh asd"        
36 seconds ago      Up 35 seconds       0.0.0.0:3000-3003->3000-3003/tcp, 0.0.0.0:8081->8081/tcp   aerospike

我已登录Docker容器

$ docker exec -it b0b4c63d7e22 bash
root@b0b4c63d7e22:/#

我列出了目录 -

root@b0b4c63d7e22:/# ls
bin  boot  core  dev  entrypoint.sh  etc  home  lib  lib64  media  mnt  opt  
proc  root  run  sbin  srv  sys  tmp  usr  var
root@b0b4c63d7e22:/#

我将目录更改为bin文件夹并列出了命令

root@b0b4c63d7e22:/# cd bin
root@b0b4c63d7e22:/bin# ls
bash   dnsdomainname  ip          mount          readlink    systemctl                       
touch         zegrep
cat    domainname     journalctl  mountpoint     rm          systemd                         
true          zfgrep
chgrp  echo           kill        mv             rmdir       systemd-ask-
password            umount        zforce
chmod  egrep          ln          netstat        run-parts   systemd-escape                  
uname         zgrep
chown  false          login       networkctl     sed         systemd-inhibit                 
uncompress    zless
cp     fgrep          loginctl    nisdomainname  sh          systemd-machine-
id-setup        vdir          zmore
dash   findmnt        ls          pidof          sh.distrib  systemd-notify                  
wdctl         znew
date   grep           lsblk       ping           sleep       systemd-tmpfiles                
which
dd     gunzip         mkdir       ping6          ss          systemd-tty-ask-
password-agent  ypdomainname
df     gzexe          mknod       ps             stty        tailf                           
zcat
dir    gzip           mktemp      pwd            su          tar                             
zcmp
dmesg  hostname       more        rbash          sync        tempfile                        
zdiff

然后我想查看服务 -

root@b0b4c63d7e22:/bin# service amc status
amc: unrecognized service

2 个答案:

答案 0 :(得分:3)

Aerospike的官方docker容器没有Aerospike Server作为守护进程运行,而是作为前台进程运行。您可以在官方github DOCKERFILE中看到这一点。

AMC不是Aerospike的Docker Image的一部分。您可以从您选择的环境中运行AMC。

最后,由于您尚未创建自定义aerospike.conf文件,因此Aerospike Server将仅响应Docker内部网络上的客户端。 -p参数本身不足以将Aerospike的端口暴露给客户端,如果您希望从外部访问客户端,则还需要配置access-address码头工人的环境。有关Aerospike网络的更多信息,请访问:https://www.aerospike.com/docs/operations/configure/network/general

答案 1 :(得分:3)

您可以为amc构建自己的Docker容器,以连接到容器上运行的aerospike。

以下是AMC的Dockerfile示例。

cat Dockerfile 

FROM ubuntu:xenial

ENV AMC_VERSION 4.0.13 


# Install AMC server 


RUN \
  apt-get update -y \
  && apt-get install -y wget python python-argparse python-bcrypt python-openssl logrotate net-tools iproute2 iputils-ping \
  && wget "https://www.aerospike.com/artifacts/aerospike-amc-community/${AMC_VERSION}/aerospike-amc-community-${AMC_VERSION}_amd64.deb" -O aerospike-amc.deb \
  && dpkg -i aerospike-amc.deb \
  && apt-get purge -y




# Expose Aerospike ports
#
#   8081 – amc port
#
EXPOSE 8081 

# Execute the run script in foreground mode
ENTRYPOINT ["/opt/amc/amc"]
CMD [" -config-file=/etc/amc/amc.conf -config-dir=/etc/amc"]

#/opt/amc/amc -config-file=/etc/amc/amc.conf -config-dir=/etc/amc

# Docker build sample:
# docker build -t amctest .

# Docker run sample for running amc on port 8081
# docker run -tid --name amc -p 8081:8081 amctest
# and access through http://127.0.0.1:8081

然后你可以建立图像:

docker build -t amctest .
Sending build context to Docker daemon  50.69kB
Step 1/6 : FROM ubuntu:xenial
 ---> 2fa927b5cdd3
Step 2/6 : ENV AMC_VERSION 4.0.13
 ---> Using cache
 ---> edd6bddfe7ad
Step 3/6 : RUN apt-get update -y   && apt-get install -y wget python python-argparse python-bcrypt python-openssl logrotate net-tools iproute2 iputils-ping   && wget "https://www.aerospike.com/artifacts/aerospike-amc-community/${AMC_VERSION}/aerospike-amc-community-${AMC_VERSION}_amd64.deb" -O aerospike-amc.deb   && dpkg -i aerospike-amc.deb   && apt-get purge -y
 ---> Using cache
 ---> f916199044d8
Step 4/6 : EXPOSE 8081
 ---> Using cache
 ---> 06f7888c1721
Step 5/6 : ENTRYPOINT /opt/amc/amc
 ---> Using cache
 ---> bc39346cd94f
Step 6/6 : CMD  -config-file=/etc/amc/amc.conf -config-dir=/etc/amc
 ---> Using cache
 ---> 8ae4300e7c7c
Successfully built 8ae4300e7c7c
Successfully tagged amctest:latest

最后通过端口转发到端口8081运行它:

docker run -tid --name amc -p 8081:8081 amctest
a07cdd8bf8cec6ba41ce068c01544920136a6905e7a05e9a2c315605f62edfce