Dockerize my java application

Hello ,
I am new to Docker . I started learning it . My task is to Dockerize my java application which runs on a iplanet webserver in rhel7 . After reading about Docker . I have some questions .

    1. In the Dockerfile , can I use a rhel7 image in FROM . and then followed by RUN to deploy the tar files.
    1. Are the images present in Docker hubs is build upon a underlying operating system or they are just softwares .
    1. after creating a Docker container , how can I get in the same to check the containers file system etc.

Questions may seems to be very basic . Please help me to understand docker better .



Yes, basic questions, but it helps to have someone confirm your understanding.

You are right that you should create a new Dockerfile and use one of the RHEL images in the FROM line. Of course, you will need to get a subscription for the RHEL instance you will be standing up. If you have no hard reqirements to use RHEL, you might consider it for the Docker host operating system (to make your Sysadmins happy) and then use one of the Debian or Alpine images since they do not require subscriptions and you can stand up as many instances of the web server as you want on your Docker host or on a Docker Swarm. Once you have the FROM line, you can use RUN lines to install everything else. You can even use the package manager for the container’s OS to install just like you would do from the command line. If iPlanet is from tar files, you can use curl or scp to download them and install them (depending on if they are at a web site or a local server).

As far as how the magic between the Host operating system resources and Docker’s work, I think that is best understood by reading this nice article

If you want to get into the docker container after it is started, you do the following:

$ docker exec -it <your container name> /bin/bash

Assuming that your container has bash, Alpine based containers, to my knowledge, only have sh. Of course if you want to get fancy, run a portainer container as well that will give you a nice UI that you can use to get a shell into the container as well as starting and stopping it.

Have fun!

1 Like

Wow … Thanks a lot for the response . I followed the steps and was able to start my first Docker containers :smile: . As you said it is very interesting . I will keep digging in to get the better out of this
Thanks again

Excellent! Glad I could help!

I do have a question. Is it possible to use the Host’s OS . So in FROM is there something I can mention such that it would take the image of host OS .

Unfortunately, no way that I know of. Think of each container as its own little microcosm of OS and applications. The only way that might be similar is to start FROM scratch and then set up the container with a similar OS. I’ve never done that myself, but maybe someone else has?