tomcat 403 error and ls: cannot open directory '.': Permission denied

  When using docker to test the tomcat deployment project on the centos7 linux system, I found the first error: the browser returned a 403 error, which is obviously a permission problem and access is forbidden. Below is my step by step operation;

1 When using docker to run tomcat, use the following commands:

docker run --name mytomcat -p 8080:8080 -v $PWD/wlsweb:/usr/local/tomcat/webapps/wlsweb -d tomcat 

2 Then use the following command to create a virtual tomcat directory.

docker exec -it mytomcat /bin/bash

3 Use the cd command to enter the tomcat/webapps/wlsweb folder and use the ls command to find a second error:

ls: cannot open directory '.': Permission denied
At this time, I found that the problem should appear here, because I have no permission to manually ls to view the directory, and the http request has no permission. Online query found that a --privileged=true

4 Re-delete the mytomcat container:

docker rm mytomcat [names or container id]

5 Rerun tomcat again with the following command:

docker run --name mytomcat -p 8080:8080 --privileged=true  -v $PWD/wlsweb:/usr/local/tomcat/webapps/wlsweb -d tomcat
 

6 Finally, use the following command again to enter the tomcat virtual path

docker exec -it mytomcat /bin/bash

The following is successful, you can directly use ls to access the wlsweb folder, and then use the browser to access the project normally.

 

 
 


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324516756&siteId=291194637