docker-library / docker-library/tomcat

SEVERE [main] org.apache.catalina.startup.HostConfig.beforeStart Unable to create directory for deployment: [/usr/local/tomcat/conf/Catalina/localhost] Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]

Open
#316 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
635
Forks
744
PR merge metrics
No merged PRs in 30d

Description

When running a tomcat Docker image, this error appears, despite the container seems to go on with the execution:
SEVERE [main] org.apache.catalina.startup.HostConfig.beforeStart Unable to create directory for deployment: [/usr/local/tomcat/conf/Catalina/localhost] Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]

Steps to reproduce:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal

Docker version 20.10.23, build 7155243

With the Docker image:

FROM tomcat:10.1.25-jdk17

#RUN mkdir -p /usr/local/tomcat/conf/Catalina/localhost #Hardcoding this privilege will obviously solve the problem

ADD ./asapianpr/asapianpr.war /usr/local/tomcat/webapps/
ADD ./asapianpr/ROOT /usr/local/tomcat/webapps/ROOT
RUN chown -R 8877:8877 /usr/local/tomcat/webapps/
RUN chmod -R g+rwx /usr/local/tomcat/webapps/

RUN chown -R 8877:8877 /usr/local/tomcat/temp/
RUN chmod -R g+rwx /usr/local/tomcat/temp/

RUN chown -R 8877:8877 /usr/local/tomcat/work/
RUN chmod -R g+rwx /usr/local/tomcat/work/

RUN mkdir -p /usr/local/tomcat/config
ADD ./asapianpr/config/asapianpr.settings /usr/local/tomcat/config/
RUN chown -R 8877:8877 /usr/local/tomcat/config/
RUN chmod -R g+rwx /usr/local/tomcat/config/

ADD ./setenv.sh /usr/local/tomcat/bin
RUN chown -R 8877:8877 /usr/local/tomcat/bin/
RUN chmod -R g+rwx /usr/local/tomcat/bin/

ENV TZ="Europe/Rome"

RUN useradd -ms /bin/bash -u 8877 user

USER user

EXPOSE 8080

CMD ["catalina.sh", "run"]

This seems to be a known old problem: #128 and #209 .

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Dockerfile, the tomcat:10.1.25-jdk17 image, and the catalina.sh entry point; reproduce the startup under USER user on Ubuntu 20.04. Review the related issues #128 and #209 for prior context. Done should include a confirmed cause and a documented startup behavior without the reported SEVERE error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, shell
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.