Question

Getting Error while installing Tomcat 10

Posted December 9, 2020 301 views
DockerJava

Hi,

I followed steps to install tomcat 10 on docker to create image butting getting error please see the details of the step and solve my problem

sudo docker pull ubunt
sudo docker run -it -d ubuntu
sudo docker exec -it cointainer_id /bin/bash
#apt-get -y install default-jdk
#groupadd tomcat
#useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
# cd /tmp
#  wget https://downloads.apache.org/tomcat/tomcat-10/v10.0.0-M10/bin/apache-tomcat-10.0.0-M10.tar.gz
# mkdir /opt/tomcat
# tar xzvf apache-tomcat-*tar.gz -C /opt/tomcat --strip-components=1
#cd /opt/tomcat
#chgrp -R tomcat /opt/tomcat
#chmod -R g+r conf
#chmod g+x conf
# chown -R tomcat webapps/ work/ temp/ logs/
#nano /etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target
#systemctl daemon-reload

Got the following ERROR

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

HI @gopinathks7,

Looking all over it seems this is related to using systemctl rather than server to start/stop services.

From what you’ve provided, I can see most of it is commented out but can you try using the following Tomcat image if you are already not :

https://hub.docker.com/_/tomcat