1

我一直在阅读文档,但仍然无法弄清楚如何让 IBM/Secure-Gateway-client 在 docker 中使用 ACL 文件选项运行。

我已经拉取了客户端 docker 镜像,并且一直在使用以下语法:

bash -c 'nohup docker run ibmcom/secure-gateway-client --F aclfile.txt xxx_stage_ng  > tmp/run_sgc.log 2>&1 &'

我在日志中得到的所有内容如下:

[2015-09-30 11:30:41.764] [ERROR] An exception occurred reading or processing the ACL file, error is Error: ENOENT, no such file or directory 'aclfile.txt'
[2015-09-30 11:30:41.764] [WARN] The ACL has been set to DENY ALL until this is fixed.
[2015-09-30 11:30:43.779] [INFO] The Secure Gateway tunnel is connected

我已经给出了文件的完整路径,没有路径(如上)和我能想到的任何临时选项。容器运行,但没有使用我想在 ACL 文件中指定的选项。

4

2 回答 2

1

这就是我所做的:

1) 创建一个 Dockerfile 以包含 aclfile.txt

FROM ibmcom/secure-gateway-client
ADD aclfile.txt /tmp/aclfile.txt

2)构建一个新的docker镜像

docker build -t ads-secure-gateway-client .

3) 运行新的 docker 镜像(需要指定 -t 和 -i 选项,否则会得到错误文件未找到):

docker run -t -i ads-secure-gateway-client  --F /tmp/aclfile.txt

4)得到以下输出:

[2015-09-30 16:50:32.084] [INFO] The current access control list is being reset and replaced by the user provided batch file: /tmp/aclfile.txt
[2015-09-30 16:50:32.086] [INFO] The ACL batch file process accepts acl allow :8000
[2015-09-30 16:50:32.087] [INFO] The ACL batch file process accepts acl deny localhost:22

我希望这会有所帮助。

于 2015-09-30T20:53:24.067 回答
0

要在 docker 中使用从主机到 docker 实例的交互式“cp”支持,您必须使用 docker 1.8.0。您可以使用以下方法进行检查:

docker --version

完成此操作后,您的版本应显示如下。建议您允许 docker 以非 root 用户身份运行,因此请在将引擎升级到 1.8.0 或 1.8.2 后运行建议的命令。

Client:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0a8c2e3
 Built:        Thu Sep 10 19:21:21 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   0a8c2e3
 Built:        Thu Sep 10 19:21:21 UTC 2015
 OS/Arch:      linux/amd64

然后将您的 acl 文件列表推送到 docker 映像,请按照下列步骤操作:

  1. 运行 'docker ps' 命令以查找您的容器 ID

    容器 ID 图像命令创建的状态端口名称 764aadce386b ibmcom/secure-gateway-client "node lib/secgwclient" 27 秒前 Up 26 seconds condescending_nobel

  2. 使用容器 ID 或名称使用“docker cp”命令复制 acl.list:

    docker cp 01_client.list 764aadce386b:/root/01_client.list

  3. 接下来,在 docker 中运行的安全网关客户端中:

    cli> F /root/01_client.list

     [2015-10-01 08:12:30.091] [INFO] The current access control list is being reset and replaced by the user provided batch file: /root/01_client.list
     [2015-10-01 08:12:30.093] [INFO] The ACL batch file process accepts acl allow 127.0.0.1:27017
     [2015-10-01 08:12:30.094] [INFO] The ACL batch file process accepts acl allow 127.0.0.1:22
    
于 2015-10-01T12:25:44.803 回答