如何使用Python SDK为容器设置UID和GID?

huangapple go评论76阅读模式
英文:

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

根据您提供的链接的文档,将 usergroup_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.

huangapple
  • 本文由 发表于 2023年6月2日 13:28:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387362.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定