Analysis of permissions required to run docker

Analysis of permissions required to run docker

Running Docker requires root privileges.

To solve the problem that non-root users do not have permission to run docker commands, the method is as follows:

Method 1:

Use sudo to obtain administrator privileges and run docker commands. This method has many limitations when executing docker commands through scripts.

Method 2:

When the docker daemon is started, the user group named docker is given the permission to read and write the Unix socket by default. Therefore, as long as the docker user group is created and the current user is added to the docker user group, the current user will have the permission to access the Unix socket and can execute docker-related commands.

sudo groupadd docker #Add docker user group sudo gpasswd -a $USER docker #Add the logged in user to the docker user group newgrp docker #Update the user group

Replenish:

How to get root privileges in a docker container

First, your container must be running

You can view the CONTAINER ID of the container through sudo docker container ls or sudo docker ps

Finally execute the command (7509371edd48 is the CONTAINER ID found above)

sudo docker exec -ti -u root 7509371edd48 bash

This is the end of this article about the permission analysis required to run docker. For more information about whether docker requires root permissions, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  js to make a simple calculator

>>:  Teach you MySQL query optimization analysis tutorial step by step

Recommend

Example code of vue + element ui to realize player function

The display without the effect picture is just em...

MySQL data archiving tool mysql_archiver detailed explanation

Table of contents I. Overview 2. pt-archiver main...

A nice html printing code supports page turning

ylbtech_html_print HTML print code, support page t...

New ways to play with CSS fonts: implementation of colored fonts

What if you designers want to use the font below ...

SQL implementation of LeetCode (175. Joining two tables)

[LeetCode] 175.Combine Two Tables Table: Person +...

Introduction and use of five controllers in K8S

Table of contents Controller type of k8s Relation...

5 ways to determine whether an object is an empty object in JS

1. Convert the json object into a json string, an...

Simple CSS text animation effect

Achieve results Implementation Code html <div ...

Tutorial on how to remotely connect to MySQL database under Linux system

Preface I recently encountered this requirement a...

CSS to implement QQ browser functions

Code Knowledge Points 1. Combine fullpage.js to a...

Usage of if judgment in HTML

In the process of Django web development, when wr...

How to write beautiful HTML code

What Beautiful HTML Code Looks Like How to write ...

Analysis of Hyper-V installation CentOS 8 problem

CentOS 8 has been released for a long time. As so...