docker install nginx
1. Obtain root permissions through the su command
2. Start docker
systemctl start docker
Effect:
3. Download nginx mirror
docker pull nginx
Effect:
4. View the mirror image
docker images
Effect: Here you can see that nginx has been installed.
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:
6. Test
curl localhost:3344
*Test by sending request
Effect:
Docker install tomcat, and tomcat access 404 solution
1. Download the tomcat mirror,
docker pull tomcat
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:
3. Test
curl localhost:3355
Effect: You will find that 404 is returned
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
3 test
* Access through the virtual machine ip address and the previously mapped port
4. Exit the container
exit
docker install mysql
1. Pull the mysql mirror
docker pull mysql
Effect:
2. View the local mirror
docker images
Effect:
3. Run the container
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 镜像id
4. View the container
5. Enter the container and access mysql