I am very new to Docker. I am using mac OS and i have a local Jenkins server up and running. I would like to simulate the red hat Linux environment by using docker. I am supposed to perform the following steps,
Get the docker image for RHEL - (Red Hat Enterprise Linux) From where shall i get docker image for RHEL?
Pull the images for JDK, Jenkins.
Run the jenkins server and set up the new jobs
Are the above steps correct? Am i going in the correct direction?
You are going to need to create a custom Dockerfile as by default Jenkins runs on Alpine or the OpenJDK image. The OpenJDK image, in turn is based upon a specific version of buildpack-deps that is based upon Debian. While you can create a dockerfile with multiple FROM statements, it is buggy and I wouldn't recommend it.
Based upon what I could find (I reserve the right to be Wrong on this, since I don't typically use RHEL in a docker environment), there is no official RHEL image for docker. That article goes over how to create one. Alternatively, there are centos images, so that would likely be your best course. If there is no compromising the official RHEL, you are stuck doing what that article states or trusting an unofficial image made by Some Person.
Once you've sorted the above out, you'll need to start building the Dockerfile to accommodate Jenkins. I would look at the OpenJDK8 and Jenkins Dockerfile port it (to the extent it is able) to Redhat/Centos
That would be easy once the other portions are done. You can follow the directions at the official Jenkins Docker hub
Not in my opinion. Docker shouldn't really be used to test environments like that. First, it won't be a real good test since it's effectively a chroot/"special" environment if you are expecting to run this on non-docker environment. If you are expecting to run it in docker, you are re-inventing the wheel by making the wheel square, since you already have an official Jenkins image.