Docker installs nginx, tomcat, and tomcat access 404 solution, mysql

docker install nginx

1. Obtain root permissions through the su command
2. Start docker

systemctl start docker

Effect:
Insert picture description here
3. Download nginx mirror

docker pull nginx

Effect: Insert picture description here
4. View the mirror image

docker images

Effect: Here you can see that nginx has been installed.
Insert picture description here
5. Start nginx
*-d: start in the
background -name: take an alias
-p: the host opens port 3344 and maps to port 80 of nginx, and the external network can be through port 3344 Visited

docker run -d --name nginx01 -p 3344:80 镜像id

Effect:
Insert picture description here
6. Test

curl localhost:3344

*Test by sending request
Effect:
Insert picture description here

Docker install tomcat, and tomcat access 404 solution

1. Download the tomcat mirror,

docker pull tomcat

Insert picture description here
2. Start tomcat

docker run -d --name tomcat01 -p 3355:8080 镜像id

*-d: Start in the
background -name: take an alias
-p: the host opens port 3355 and maps to port 8080 of tomcat, and the external network can be accessed through port 3355.
Effect: Insert picture description here
3. Test

curl localhost:3355

Effect: You will find that 404 is returned
Insert picture description here

Return 404 solution

1. Enter the tomcat container

docker exec -it tomcat01 /bin/bash  

2. Copy the files under the webapps.dist folder to webapps

cp -r webapps.dist/* webapps

Effect: Found that there are several files under the webapps folder, you can
Insert picture description here
3 test
* Access through the virtual machine ip address and the previously mapped port
Insert picture description here
4. Exit the container

exit

docker install mysql

1. Pull the mysql mirror

docker pull mysql

Effect: Insert picture description here
2. View the local mirror

docker images

Effect:
Insert picture description here
3. Run the container

docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 镜像id

4. View the container
Insert picture description here
5. Enter the container and access mysql
Insert picture description here

Guess you like

Origin blog.csdn.net/moerduo0/article/details/112745542