简体   繁体   English

通过Web服务器访问Docker映像

[英]Access docker image through web server

I am using a docker image and I can successfully access it and run it through a python script from my host machine. 我正在使用docker映像,我可以成功访问它并从主机通过python脚本运行它。 I am using sidomo for that purpose. 我正在为此目的使用sidomo。 The script works fine locally but doesn't give any output when I run it on server. 该脚本在本地可以正常运行,但在服务器上运行时不提供任何输出。 Even the docker images command doesn't give correct output on server. 甚至docker images命令也无法在服务器上提供正确的输出。 The output is: 输出为:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

What permissions do I need to change in order to access my docker image from server? 我需要更改哪些权限才能从服务器访问我的Docker映像? I only need the output from the docker program in my web application. 我只需要Web应用程序中docker程序的输出即可。

Accessing the docker daemon remotely is dangerous. 远程访问docker守护程序很危险。 It is equivalent to root access. 它等效于root访问。 This is why the daemon's socket can be accessed by root and on most setups the members of the docker group only. 这就是为什么root用户可以访问守护程序的套接字的原因,而在大多数设置中,只能由docker组的成员访问。

Now I'm at a point where I'm unsure to tell you how to allow access for your application. 现在,我不确定要告诉您如何允许访问您的应用程序。 You don't seem to have deep experience in Linux permission which would be required to secure your web application. 您似乎没有Linux权限的丰富经验,而这是保护Web应用程序所需的权限。

So it giv only the concept, not the commmand: add the user your web application is running as to the docker` group. 因此,它仅提供概念,而不是命令:将您的Web应用程序正在运行的用户添加到docker`组。

And one last reminder: Secure the web application! 最后提醒:保护Web应用程序! It will be the only security you have for your sever then. 届时它将是您拥有的唯一服务器安全性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM