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 Supplement: Solve the problem that non-root users do not have permission to run docker commands Problem description:
Reason (from the docker manual):
The answer is obvious. Either use the root user, or create a user group called docker and add the non-root user you need to use docker to the group. If you don't know how to do it yet, keep reading. 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 The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: Share some uncommon but useful JS techniques
>>: A brief discussion on HTML table tags
@Font-face basic introduction: @font-face is a CSS...
Table of contents 1. Docker Image 2. Create an in...
<br />Semanticization cannot be explained in...
Table of contents Preface Global Lock Full databa...
This article is original by 123WORDPRESS.COM Ligh...
If you accidentally modify the source.list conten...
Table of contents Show Me The Code Test the effec...
Copy code The code is as follows: <div class=&...
Since we are going to upload pictures, the first ...
The effect achievedImplementation Code html <d...
In Nginx, there are some advanced scenarios where...
This article example shares the specific code of ...
Table of contents background analyze method backg...
MySQL 8 new features: My personal opinion on MySQ...
SQL UNIQUE constraint The UNIQUE constraint uniqu...