• Docker安装Tomcat


    前言

    本章将使用docker安装mongo,前提条件是已经安装完docker并会使用docker。
    如果还没有安装docker,可以参考在CentOS7下安装Docker

    安装Tomcat

    在Docker Hub上查找镜像


    拉取官方的镜像

    [root@e2ab0x9jme3furrd ~]# docker pull tomcat:9.0
    

    查看本地镜像

    [root@e2ab0x9jme3furrd ~]# docker images
    

    运行容器

    [root@e2ab0x9jme3furrd ~]# docker run --name tomcat01 -p 8081:8080 -d tomcat:9.0
    f48d4a466fcd5da764d45068763f30f161e02ff0d4b0cc50be3f008b059f8493
    

    查看容器启动情况

    [root@e2ab0x9jme3furrd ~]# docker ps
    

    浏览器访问

    输入网址后,我们发现,报了404的错误。这说明我们Tomcat是安装正确了,只是在webapp下面找不到文件去显示。
    那么,我们开始解决这个问题。

    问题解决

    我们去容器内部看看

    [root@e2ab0x9jme3furrd ~]# docker exec -it 2b8079038325 /bin/bash
    root@2b8079038325:/usr/local/tomcat# ls
    BUILDING.txt  CONTRIBUTING.md  LICENSE NOTICE README.md  RELEASE-NOTES  RUNNING.txt  bin  conf  lib  logs  native-jni-lib  temp  webapps  webapps.dist  work
    root@2b8079038325:/usr/local/tomcat# cd webapps
    root@2b8079038325:/usr/local/tomcat/webapps# ls
    root@2b8079038325:/usr/local/tomcat/webapps# cd ../webapps.dist
    root@2b8079038325:/usr/local/tomcat/webapps.dist# ls
    ROOT  docs  examples  host-manager  manager
    

    可以发现,webapps目录下没有东西,而webapps.dist目录下存在ROOT。我们可以考虑将webapps.dist目录下的文件拷贝到webapps下。

    root@2b8079038325:/usr/local/tomcat# cp -r webapps.dist/* webapps
    root@2b8079038325:/usr/local/tomcat# cd webapps
    root@2b8079038325:/usr/local/tomcat/webapps# ls
    ROOT  docs  examples  host-manager  manager
    

    重新通过浏览器访问

    至此,Tomcat安装完成!!!

  • 相关阅读:
    进程与线程
    the art of seo(chapter seven)
    the art of seo(chapter six)
    the art of seo(chapter five)
    the art of seo(chapter four)
    the art of seo(chapter three)
    the art of seo(chapter two)
    the art of seo(chapter one)
    Sentinel Cluster流程分析
    Sentinel Core流程分析
  • 原文地址:https://www.cnblogs.com/Gazikel/p/15675926.html
Copyright © 2020-2023  润新知