大网数据广告活动
服务器运维问答

What's the difference between rootless Docker, running a container as a non-root user, and Podman?

· 52CE 我爱测

Recently I've been trying to run my Docker application as a non-root user. I've seen there are several options available to me: Install rootless Docker : apparently this is a "non-root" version of Docker that runs containers as u…

问题原文

原帖链接 · Klangen · CC BY-SA 4.0

Recently I've been trying to run my Docker application as a non-root user. I've seen there are several options available to me:

  1. Install rootless Docker : apparently this is a "non-root" version of Docker that runs containers as users other than root.
  2. Use normal (rootful) Docker, but run containers with docker run with the --user flag.
  3. User Podman to run the container.

I am not familiar with any of these solutions, I've only ever used Docker as root. So what are the differences and advantages/disadvantages of these methods?

Isn't the result exactly the same, i.e., a container running as non-root user?

已采纳解答

原帖链接 · shodanshok · CC BY-SA 4.0

They are different things.

  • docker run --user sets the UID to be used inside the container. It is useful to limit the privileges of the specific program which run within the container itself

  • rootless docker means running the docker daemon itself as a non-privileged user. A flaw in docker itself will be contained without giving root permissions on the host system. From docker's docs:

Rootless mode allows running the Docker daemon and containers as a non-root user to mitigate potential vulnerabilities in the daemon and the container runtime.

  • podman is a daemon-less reimplementation of docker. Not having a central daemon to run/manage all the container instances is supposed to be more secure and lightweight

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-09-27)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。