AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / server / Perguntas / 981752
Accepted
Jose Cabrera Zuniga
Jose Cabrera Zuniga
Asked: 2019-09-04 12:07:36 +0800 CST2019-09-04 12:07:36 +0800 CST 2019-09-04 12:07:36 +0800 CST

Instalando o Tomcat 8.* em um contêiner docker com o Centos 7

  • 772

Eu quero criar um contêiner docker para instalar o Tomcat dentro dele. Parece que meu docker compila sem problemas e também consigo executar o tomcat sem problemas relatados pelos logs. No entanto, se eu tentar abrir o tomcat, recebo um erro 404. Eu não sei o que estou perdendo. Alguma ideia, por favor? O próximo é o conteúdo do meu Dockerfile:

FROM centos:7
MAINTAINER joseccz

EXPOSE 8080
EXPOSE 8009


RUN yum install -y mc
RUN yum install -y wget
# RUN yum install -y apr-devel openssl-devel
RUN yum install -y gcc
RUN yum install epel-release -y
RUN yum install dnf -y
RUN yum install net-tools -y
RUN yum install libtool -y

ENV JAVA_HOME       /opt/javaSDK
ENV JRE_HOME        ${JAVA_HOME}/jre

ADD javaSDK ${JAVA_HOME}

ADD tomcat.service /etc/systemd/system/




# ----------------------------------------------- Copy Tomcat Files to /opt/tomcat -----------------------------------------------
ENV TOMCAT_MAJOR 8
ENV TOMCAT_VERSION 8.5.45
ENV CATALINA_HOME   /opt/tomcat

# http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz

ENV PATH        $JAVA_HOME/bin:$CATALINA_HOME/bin:$CATALINA_HOME/lib:$PATH

RUN wget http://www-us.apache.org/dist/tomcat/tomcat-${TOMCAT_MAJOR}/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
 tar -xvf apache-tomcat-${TOMCAT_VERSION}.tar.gz 

RUN mv apache-tomcat-${TOMCAT_VERSION} tomcat

RUN rm apache-tomcat*.tar.gz
RUN mv tomcat /opt/tomcat
# --------------------------------------------------------------------------------------------------------------------------------



RUN groupadd tomcat
RUN useradd -s /bin/nologin -g tomcat -d /opt/tomcat tomcat

# RUN wget https://rpmfind.net/linux/mageia/distrib/cauldron/x86_64/media/core/release/tomcat-native-1.2.23-1.mga8.x86_64.rpm
# RUN rpm -i tomcat-native-1.2.23-1.mga8.x86_64.rpm

# RUN cd /opt/tomcat
RUN chgrp -R tomcat /opt/tomcat/conf
RUN chmod g+rwx /opt/tomcat/conf
RUN chmod g+r /opt/tomcat/conf/*
RUN chown -R tomcat /opt/tomcat/logs/ /opt/tomcat/temp/ /opt/tomcat/webapps/ /opt/tomcat/work/

RUN chgrp -R tomcat /opt/tomcat/bin
RUN chgrp -R tomcat /opt/tomcat/lib
RUN chmod g+rwx /opt/tomcat/bin
RUN chmod g+r /opt/tomcat/bin/*

#----------------------------------Create /opt/software folder for addinitonal soft needed by Tomcat ------------------------------
RUN mkdir /opt/software

#---------------------------------------- copy and compile Development tools ---------------------------------------------------------

RUN yum groupinstall "Development Tools" -y

#---------------------------------------- Donwload and install open ssl ------------------------------------------------------------
RUN wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
RUN tar -xvf openssl-1.0.2l.tar.gz
RUN mv openssl-1.0.2l openssl
RUN mv openssl /opt/software/openssl
RUN cd /opt/software/openssl && ./config -fPIC --prefix=/opt/software/ --openssldir=/opt/software/ && make && make install

#---------------------------------------- Donwload and install open apr ------------------------------------------------------------
ENV APRVERSION 1.6.5
RUN wget http://apache.mirrors.ionfish.org//apr/apr-${APRVERSION}.tar.gz
RUN tar -xvf apr-${APRVERSION}.tar.gz
RUN mv apr-${APRVERSION} apr
RUN mv apr /opt/software/apr
RUN cd /opt/software/apr/ && \
    ./configure --prefix=/opt/software/ && \
     make && make install

#------------------------------------------ Copy TOMCAT native


# compiling tomcat native

RUN cd ${CATALINA_HOME}/bin/ && \
    tar -xvf tomcat-native.tar.gz && \
    cd tomcat-native-1.2.23-src/native/ && \
     ./configure --with-apr=/opt/software/ --with-java-home=/opt/javaSDK/  --with-ssl=/opt/software  --prefix=/opt/tomcat && \
    make && \
    make install

ADD setenv.sh /opt/tomcat/bin/

o conteúdo do meu arquivo setenv.sh é:

export JAVA_HOME=/opt/javaSDK
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib
export LD_LIBRARY_PATH
docker
  • 1 1 respostas
  • 2994 Views

1 respostas

  • Voted
  1. Best Answer
    Jose Cabrera Zuniga
    2020-08-13T17:41:17+08:002020-08-13T17:41:17+08:00

    A parte importante é adicionar de alguma forma os próximos xommands ao dockerfile:

    #---------------------------------------- Donwload and install open apr ------------------------------------------------------------
    ENV APRVERSION 1.6.5
    RUN wget http://apache.mirrors.ionfish.org//apr/apr-${APRVERSION}.tar.gz
    RUN tar -xvf apr-${APRVERSION}.tar.gz
    RUN mv apr-${APRVERSION} apr
    RUN mv apr /opt/software/apr
    RUN cd /opt/software/apr/ && \
        ./configure --prefix=/opt/software/ && \
         make && make install
    
    #------------------------------------------ Copy TOMCAT native
    
    
    # compiling tomcat native
    
    RUN cd ${CATALINA_HOME}/bin/ && \
        tar -xvf tomcat-native.tar.gz && \
        cd tomcat-native-1.2.8-src/native/ && \
         ./configure --with-apr=/opt/software/ --with-java-home=/opt/javaSDK/ --with-ssl=/opt/software  --prefix=/opt/tomcat && \
        make && \
        make install
    
    ADD setenv.sh /opt/tomcat/bin/
    

    O tomcat-native.tar.gz deve ser aquele incluído na versão do Tomcat a ser instalada que está incluída no arquivo compactado de instalação do tomca. Além disso, a amostra de aplicativos do Tomcat incluída no arquivo de instalação deve ser adicionada pelo menos manualmente à pasta de aplicativos da web do Tomcat. Eu tive problemas para fazer isso automaticamente.

    • 0

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve