英文:
How to set UID and GID for the container using python sdk?
问题
如何在使用 Python SDK 启动容器时设置容器的 UID 和 GID?
英文:
How to set UID and GID for the container when Python SDK is used to spin up the container?
答案1
得分: 0
根据您提供的链接的文档,将 user
和 group_add
传递给 run()
:
client.containers.run('alpine', 'echo hello world', user='foo', group_add=[123])
两者都可以接受ID和名称,但 group_add
需要是一个列表。
英文:
As the documentation you've linked says, pass in user
and group_add
to run()
:
client.containers.run('alpine', 'echo hello world', user='foo', group_add=[123])
Both accept both IDs and names, but group_add
needs to be a list.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论