IBM / secure-gateway-client docker使用–F(acl文件)选项运行
我一直在阅读文档,仍然无法解决如何让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
我已经给出了文件的完整path,没有path(如上),我可以想到的任何临时选项。 容器运行,但不是我想要在ACL文件中指定的选项。
这就是我所做的:
1)创build一个Dockerfile来包含aclfile.txt
FROM ibmcom/secure-gateway-client ADD aclfile.txt /tmp/aclfile.txt
2)build立一个新的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
我希望有帮助。
要在Docker中使用交互式'cp'支持从主机到docker实例,您必须使用docker 1.8.0。 您可以使用以下方法检查:
docker --version
一旦你完成了这个,你的版本应该显示如下。 build议您允许docker以非root用户身份运行,因此在将引擎升级到1.8.0或1.8.2后,运行build议的命令。
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 ps”命令来查找您的容器ID
容器ID映像命令创build状态端口名称764aadce386b ibmcom / secure-gateway-client“node lib / secgwclient”27秒前上移26秒condescending_nobel
-
使用'docker cp'命令复制您的acl.list,使用容器ID或名称:
docker cp 01_client.list 764aadce386b:/root/01_client.list
-
接下来,在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