When you use the docker command for the first time, you will be prompted for permission issues.
Solution:1. Use sudo to obtain root privileges; Second, add the current user to the docker user group; 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 user group docker ps #Test whether the docker command can be used normally with sudo Supplement: Problem and solution of root user being unable to log in when deploying mysql with docker Today, when using the mysql:5.7 docker image, I found that I could not log in using the root user after starting the container. Here are the steps: 1. Pull the mysql5.7 image$ docker pull mysql:5.7 2. Create a bridge$docker network create -d bridge blog_network 3. Run the mysql containerdocker container run -it --rm --name mysql --network blog_network -v $PWD/data/myscript/:/docker-entrypoint-initdb.d/ --env MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7 4. Enter the container$ docker exec -it mysql bash #mysql -u root -p The password 123456 set in step 3 returns the result: Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 5. The solution is as followsStep 2: Run the container command and modify it as follows: $ docker container run -it --detach --name mysql --network blog_network -p 3306:3306 -v $PWD/data/myscript/:/docker-entrypoint-initdb.d/ --env MYSQL_RANDOM_ROOT_PASSWORD=yes mysql:5.7 $ docker container logs mysql| grep 'GENERATED ROOT PASSWORD: ' | awk -F': ' '{print $2}' A string will be returned, which is the actual password of our root user: log in with this password and then change the root user password. ooli0OhMoo1Ieg1CeiYieSohleeVi1oh $mysql -u root -p After entering mysql using the above password, you need to change the password. mysql>update mysql.user set authentication_string=password('newpassword') where user='root'; mysql>flush privileges; mysql>exit As shown in the figure: 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:
|
<<: Various transformation effects of HTML web page switching
>>: Media query combined with rem layout in CSS3 to adapt to mobile screens
Table of contents 1. Embed CSS styles directly in...
What problems does MySQL ROLE solve? If you are a...
Original data and target data Implement SQL state...
Table of contents Arithmetic operators Abnormal s...
General CSS code will only cause minor issues wit...
<br />The countless information on the Inter...
Table of contents Overview 1. Parent component pa...
Table of contents Supports multiple types of filt...
Execution problem between mysql max and where Exe...
1. --cpu=<value> 1) Specify how much availa...
Table of contents What does the COUNT function do...
<br />This tag is used to create a multi-lin...
This tag is not part of HTML3.2 and is only suppo...
HTML consists of two parts: head and body ** The ...