Building a custom Docker container is easy ... basically - a case for using phusion/baseimage
What challenges have I experienced?
- A Dockerfile is quickly written to contain the base image and application files you need to get started.
- Once built, the container runs smoothly when starting it with /bin/bash or sh as it is the default for many base images. From there, running a #tomcat application via .sh is really easy.
- I could use the official tomcat image, however I needed Oracles Metadata Management application to run and I had no idea how to make it work with the tomcat image. So I tried alpine (java missing), oraclelinux (not working either for some reason) and finally, the good old ubuntu base image.
- However, users of my Dockerfile (my colleagues) should not have to manually execute the shell scripts. So I want the Docker to (re)start the application server once it is created and up and running.
Why was I challenged?
- once executed, bash as a process ends and since it is the primary process (PID 1), the container ceases to run...
- but I need that tomcat server!
- Okay, basically ENTRYPOINT sets the command to be executed when a container is run. This can also be combined with custom input arguments for the command (which can also be extra commands executed when ENTRYPOINT is /bin/bash).
- However, tomcat is running as process java, a child process of the bash process doing the startup.sh
- So, again, the container stops.
How do I keep my tomcat application container running after starting?
- Some solutions are complex and hard to realize for a non-Linux-administrator
- So I read about the image phusion/baseimage
- It offers starting up services when running a container (and daemon services)
- Adding a small script to /etc/my_init.d/ did the trick
- Every time the container starts, the tomcat application is started and I can access it via the browser
I tried you GitHub Docker file, but it is not working. I am new to OEMM but is it by porpuse the OEMM..._Linux-x86-64.zip file is missing. And how is it possible to do a PoC on OEMM?
phusion/baseimage was created solve docker PID1 zombie reaping problem. I think recent versions of docker also added init option. Just to understand your post better did you have 2 CMD in your dockerfile. one for bash and one for tomcat?