Unable to run Tomcat 7 as service inside container on CoreOS

I am trying to setup tomcat 7 on Digital Ocean CoreOS machine but facing some problem, not sure how to solve them. I am following below tutorial provided by the Digital Ocean to setup Apache.


  • “No such file or directory” what's wrong in this Dockerfile?
  • (Error starting container: API error (500) Hyperledger
  • Not able to connect to Docker container on Windows
  • docker daemon exec: “dockerd” : executable not found in %PATH%
  • What are differences between Docker and Octopus Deploy
  • AWS when we have to update task definition
  • I created docker container and run it using following command.

    docker run -i -t ubuntu:14.04 /bin/bash

    I was successfully able to install tomcat 7 by using below commands. (I followed this tutorial to setup tomcat 7 within the docker container: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-ubuntu-14-04-via-apt-get)

    sudo apt-get update 
    sudo apt-get install tomcat7

    Then I can created service unit file named as tomcat@.service

    Description=Tomcat 7 web server service 
    After=etcd.service After=docker.service     
    TimeoutStartSec=0 KillMode=none 
    ExecStartPre=-/usr/bin/docker kill tomcat%i 
    ExecStartPre=-/usr/bin/docker rm tomcat%i 
    ExecStartPre=/usr/bin/docker pull attacomsian/tomcat 
    ExecStart=/usr/bin/docker run –name tomcat%i -p ${COREOS_PUBLIC_IPV4}:%i:8080 attacomsian/tomcat `service tomcat7 start` -D FOREGROUND 
    ExecStop=/usr/bin/docker stop tomcat%i

    Then I created tomcat-discovery@.service to register service states with Etcd as below

    Description=Announce Tomcat@%i service 
    ExecStart=/bin/sh -c “while true; do etcdctl set /announce/services/tomcat%i ${COREOS_PUBLIC_IPV4}:%i –ttl 60; sleep 45; done” 
    ExecStop=/usr/bin/etcdctl rm /announce/services/tomcat%i

    I submitted and loaded files to Fleet as below

    fleetctl submit tomcat@.service tomcat-discovery@.service
    fleetctl load tomcat@8080.service
    fleetctl load tomcat-discovery@8080.service

    Everything worked fine so far. I did not see any error. But when I tried to run the service as below

    fleetctl start tomcat@8080.service

    But it did not started. I can see it is appearing as dead.

    I am new to CoreOS and still learning. I am managing servers at Digital Ocean and I quite about it quite well. I googled about this issue but did not found any help. I personally think following line is actually causing the trouble.

    ExecStart=/usr/bin/docker run –name tomcat%i -p ${COREOS_PUBLIC_IPV4}:%i:8080 attacomsian/tomcat `service tomcat7 start` -D FOREGROUND

    I would really appreciate any kind help to get this up.

    Many Thanks


  • Error response from daemon: Container CONTAINER_NAME is not running
  • How to set Puma workers, threads for Rails in Docker
  • Auto dockers containers by subdomain
  • How to reduce docker image size?
  • Kubernetes Redis HA and exposing redis to things outside of the container
  • Docker install causes host machine to be unreachable
  • One Solution collect form web for “Unable to run Tomcat 7 as service inside container on CoreOS”

    I was going so suggest you take a look at what others have done and then discovered you have posted a similar question on the Docker Hub registry.

    Did you take a look at the Docker file used by the tutum/tomcat image?

    It runs a script called “run.sh” that runs tomcat in the foreground.

    The thing that is tricky to understand is that Docker is not a virtual machine and therefore does not have any services running. You must run the docker processes explicitly or setup a process manager like runit or supervisord.

    Hope this helps.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.