--privileged
时间: 2023-06-29 07:18:53 浏览: 58
`--privileged` 是 Docker 命令中的一个选项,用于给容器开启特权模式,使容器拥有主机系统的完全访问权限。在特权模式下,容器可以访问所有的设备和文件系统,并且可以执行一些普通用户无法执行的操作,例如加载内核模块、更改文件权限等等。使用 `--privileged` 可以方便地让容器运行一些需要更高权限的应用程序,但也存在一定的风险,因为容器的操作可能会对主机系统造成损坏或安全风险,所以必须谨慎使用。在实际使用中,建议尽量避免使用 `--privileged`,而是使用 `--cap-add` 来为容器添加必要的特权能力。
相关问题
docker--privileged
The `--privileged` flag in Docker allows a container to have access to all devices on the host system, including the kernel and hardware resources. This means that the container will have full root privileges and can perform any action that the host can perform, such as mounting file systems, changing network settings, and modifying kernel parameters.
Using the `--privileged` flag can be useful for running certain types of applications that require more access to the host system than a normal container would have. However, it can also be risky, as it can potentially compromise the security of the host system if the container is compromised.
It is generally recommended to avoid using the `--privileged` flag unless absolutely necessary, and to use more granular options such as `--cap-add` and `--device` to grant specific privileges as needed.
docker --privileged
docker --privileged是Docker运行时的一个选项,它允许容器内的进程拥有主机上的root权限。这个选项可以用来运行一些需要特权的应用程序,比如一些网络应用程序或者需要访问主机硬件的应用程序。但是,使用这个选项也会增加安全风险,因为容器内的进程可以对主机进行更多的操作。因此,建议只在必要的情况下使用这个选项。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)