In Linux system, newly install docker and enter the command, such as: docker images The result was abnormal. Simply put, the current user's connection is rejected. Solution 1:Use administrator privileges, add sudo before the command Solution 2:Add the current user to the docker user group sudo groupadd docker #Add the docker user group. This user group should already exist. sudo gpasswd -a $USER docker #Add the current user to the docker user group. newgrp docker #Update the user group docker. Then execute docker images This can be used normally Supplement: Docker -v has no permission for the mounted directory. Solution to Permission denied Description of the situationToday I am using docker run -d -p 9091:8080 -v /home/daniu/docker/tomcat/webapps/:/usr/local/tomcat/webapps/ --name managertomcat daniu/mytomcat After mounting the path, enter the container root@08066d03a043:/usr/local/tomcat# cd webapps/ root@08066d03a043:/usr/local/tomcat/webapps# ls ls: cannot open directory '.': Permission denied root@08066d03a043:/usr/local/tomcat/webapps# When viewing webapps, it prompts that there is no permission. reason:The security module selinux in centos7 disabled the permissions. There are three ways to solve it:1. Add --privileged=true at runtime[daniu@localhost tomcat]$ docker run -d -p 9091:8080 -v /home/daniu/docker/tomcat/webapps/:/usr/local/tomcat/webapps/ --privileged=true --name managertomcat xuhaixing/mytomcat c512137b74f3366da73ff80fc1fd232cc76c95b52a4bab01f1f5d89d28185b28 [daniu@localhost tomcat]$ ls 2. Temporarily turn off selinux and then turn it on again[daniu@localhost tomcat]# setenforce 0 [daniu@localhost tomcat]# setenforce 1 3. Add linux rules and add the directory to be mounted to the selinux whitelist# The format for changing security context is as follows: chcon [-R] [-t type] [-u user] [-r role] File or directory options without parameters: -R: All directories under this directory are also modified at the same time; -t: followed by the type field of the security document, for example httpd_sys_content_t; -u : followed by identity identification, for example system_u; -r: The color of the following street, for example system_r implement: chcon -Rt svirt_sandbox_file_t /home/daniu/docker/tomcat/webapps/ 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:
|
<<: MySQL database deletes duplicate data and only retains one method instance
>>: HTML Frameset Example Code
Under the requirements of today's responsive ...
1. Install vue-cli npm i @vue/cli -g 2. Create a ...
1. Install Python 3 1. Install dependency package...
Table of contents Preface 1. Props, $emit one-way...
Ubuntu 20.04 does not have root login enabled by ...
The nginx configuration file is mainly divided in...
Today's Tasks 1. Choice of Linux distribution...
Table of contents 1. Demand 2. Implementation 3. ...
Table of contents 1. Overview 2. Define a simple ...
Table of contents Preface Introduction ngram full...
Table of contents background What is tablespace f...
Table of contents Overview The history of CPU-bou...
Table of contents 1. Effect display 2. Enhanced v...
Table of contents 1. What is currying 2. Uses of ...
Passive Check With passive health checks, NGINX a...