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

Detailed steps to install MySQL 5.7 via YUM on CentOS7

1. Go to the location where you want to store the...

A brief discussion on how to use slots in Vue

How to define and use: Use the slot tag definitio...

Introduction to new features of MySQL 8.0.11

MySQL 8.0 for Windows v8.0.11 official free versi...

Detailed tutorial on building nextcloud private cloud storage network disk

Nextcloud is an open source and free private clou...

Summary of Common Letters in Unicode

Most of the earliest computers could only use ASC...

Centos7 installation and configuration of Mysql5.7

Step 1: Get the MySQL YUM source Go to the MySQL ...

Analysis of permissions required to run docker

Running Docker requires root privileges. To solve...

Example of compiling LNMP in Docker container

Table of contents 1. Project Description 2. Nginx...

Detailed steps to download Tomcat and put it on Linux

If you have just come into contact with Linux, th...

Pure CSS to achieve the list pull-down effect in the page

You may often see the following effect: That’s ri...

MySQL compressed package version zip installation configuration method

There are some problems with the compressed versi...

JavaScript canvas to achieve raindrop effects

This article example shares the specific code of ...