Problems:After adding the -v parameter to docker run, the container will always be in the restarting state. Removing the -v parameter will allow it to run normally. Find the problem:Use docker logs 'containerId' This containerId is the containerId returned after docker run As you can see, it is a permission denied issue. Solving the problem:Add parameters when running docker: add --privileged=true For example: docker run -dit -e MYSQL_ROOT_PASSWORD=123456 --name saasdev-mysql --restart always -v /home/data/mysql:/var/lib/mysql --privileged=true -p 3308:3306 mysql:5.6 The problem was successfully solved and the container started normally A little explanation:--privileged=true With this parameter, the root in the container has real root permissions. Otherwise, the root in the container has only the permissions of an ordinary user outside. A container started with privileged can see many devices on the host and can mount them. It even allows you to start a docker container within a docker container Supplement: docker --restart=always parameter docker restarts the container automatically When you add the parameter --restart=always when creating a container, the container will automatically start when Docker is restarted. Directions:docker container update --restart=always container name The operation examples are as follows:[root@localhost mnt]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 46cdfc60b7a6 nginx "nginx -g 'daemon ..." About a minute ago Up 42 seconds 80/tcp n3 79d55a734c26 nginx "nginx -g 'daemon ..." About a minute ago Up 42 seconds 80/tcp n2 f7b2206c019d nginx "nginx -g 'daemon ..." About a minute ago Up 46 seconds 80/tcp n1 [root@localhost mnt]# docker container update --restart=always n1 n1 [root@localhost mnt]# systemctl restart docker [root@localhost mnt]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 46cdfc60b7a6 nginx "nginx -g 'daemon ..." 2 minutes ago Exited (0) 5 seconds ago n3 79d55a734c26 nginx "nginx -g 'daemon ..." 2 minutes ago Exited (0) 5 seconds ago n2 f7b2206c019d nginx "nginx -g 'daemon ..." 2 minutes ago Up 2 seconds 80/tcp n1 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:
|
<<: A brief discussion of the interesting box model of CSS3 box-sizing property
>>: MySQL 8.0 New Features - Introduction to Check Constraints
How to add css in html? There are three ways to s...
view: Views in MySQL have many similarities with ...
The layout problem of irregular picture walls enc...
The code under the easyui framework is as follows...
Preface The latest version of MySQL 8.0 is 8.0.4 ...
mysql-5.7.9 finally provides shutdown syntax: Pre...
In this article, I will show you how to install a...
This article shares the specific code of JavaScri...
Preface I just started learning MySQL and downloa...
Linux change hostname command 1. If you only need...
Experimental environment A minimally installed Ce...
When we use the folder properties dialog box in Wi...
I didn't use MySQL very often before, and I w...
The Nginx ngx_http_image_filter_module module (ng...
Find the problem When retrieving the top SQL stat...