Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the privileged parameter in the yml file of Docker Compose

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is to share with you about the usefulness of the privileged parameter in Docker Compose's yml file. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

DockerCompose is a command-line tool provided by docker to define and run applications composed of multiple containers. Using compose, we can define each service (container) of the application as a YAML file (docker-compose.yml) in the multi-container application directory, and then all the application containers can be created and started by a single command dockercomposeup-d in the application directory.

What is the purpose of the privileged parameter in the yml file of DockerCompose? Turned over the document, Baidu and Google, but did not find, please help explain.

Why do fpm and nginx need this parameter, while web doesn't? As shown in the following figure:

Around version 0. 6, privileged was introduced into docker.

With this parameter, the root within the container has real root permissions.

Otherwise, the root within the container is just an external normal user right.

The container started by privileged, you can see many devices on host, and you can execute mount.

It even allows you to start the docker container in the docker container.

Privileged parameter description

Image= > Mirror

Container_name= > Container name

Volume= > Mount directory

Ports= > Port

In the configuration file, we can see the details of all the containers that support the application.

The following files describe the operation of onlinejudgedeploy, supported by the operation of four containers:

Oj-redis

Oj-postgres

Judge-server

Oj-backend

Version: "3"

Services:

Oj-redis:

Image:redis:4.0-alpine

Container_name:oj-redis

Restart:always

Volumes:

-. / data/redis:/data

Oj-postgres:

Image:postgres:10-alpine

Container_name:oj-postgres

Restart:always

Volumes:

-. / data/postgres:/var/lib/postgresql/data

Environment:

-POSTGRES_DB=onlinejudge

-POSTGRES_USER=onlinejudge

-POSTGRES_PASSWORD=onlinejudge

Thank you for reading! This is the end of this article on "what is the use of privileged parameters in Docker Compose's yml file". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report