Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过python脚本在Debian OS上的控制台中填写docker登录信息_Python_Docker_Debian - Fatal编程技术网

如何通过python脚本在Debian OS上的控制台中填写docker登录信息

如何通过python脚本在Debian OS上的控制台中填写docker登录信息,python,docker,debian,Python,Docker,Debian,这个脚本的要点是,当Debian操作系统上的终端自动引导时,应该在所需的登录用户名和密码中填写一个已经存在的用户名和密码,这样就可以访问docker映像,以便用户可以看到它们 我希望我的解释是正确的,如果你需要更多的澄清,请问 谢谢:)为此,您必须使用Docker SDK For Python。您可以通过以下方式通过pip进行安装: pip安装docker 然后,您可以使用以下选项: 导入docker client=docker.from_env() client.login(用户名=您的\用户

这个脚本的要点是,当Debian操作系统上的终端自动引导时,应该在所需的登录用户名和密码中填写一个已经存在的用户名和密码,这样就可以访问docker映像,以便用户可以看到它们

我希望我的解释是正确的,如果你需要更多的澄清,请问


谢谢:)

为此,您必须使用Docker SDK For Python。您可以通过以下方式通过pip进行安装:

pip安装docker

然后,您可以使用以下选项:

导入docker
client=docker.from_env()
client.login(用户名=您的\用户名,密码=您的\密码)

感谢您的解决方案!
import os
os.system("sudo docker login")
//this should be filled in with username first then enter pressed.
//once enter is pressed for the username a password is required which should also be filled in then enter pressed
os.system("sudo docker images")
//to check the images on docker