Starting with DevOps: Deploying Applications on your Docker JBoss EAP Image

What really is DevOps?

For many organizations, the ability to innovate at a rapid pace responding to market conditions and customer feedback is a key element for success. Companies like Red Hat, Google, Facebook, SalesForce and Twitter, update their applications many of times a day and try to reduce the time of delivery of new features, updates and enhancements through task automation, integrated testing, etc. This has brought great gains to these corporations and at the same time decreased the risk of bugs, because the updates are performed in “smaller packages” making it easier to identify any problems. This culture automation, continuous integration in large-scale test has been called DevOps.

DevOps not have a formal definition, but his philosophy is not new, since many of its principles were born of the agile movement. DevOps can be described as a movement of professionals who preach working with collaborative relationship between the development team (Dev) and the team of operations (Ops), resulting in a quick planned workflow, while maintaining the reliability, stability, resilience and safety in a production environment. The principles and DevOps practices confirm that the high-performance IT is strongly related to business performance, helping to increase productivity and profitability in the market. Promoting integration and collaboration between the areas of development, operation and business.

New technologies emerge every day, and one of those has been highlighted by facilitating the adoption of some DevOps practices through continuous integration using Docker containers.



Docker is a container-based software framework for automating deployment of applications. Docker enables developers and sysadmins to build, ship and run distributed applications anywhere. You can think of Docker containers as sort-of lightweight virtual machines and can run on almost any platform.

Docker have been released as part of the extras channel in Red Hat Enterprise Linux 7. The steps for installing  are generally as simple. Install it using the following command:

# yum -y install docker


Now you have Docker installed onto your machine, start and enable the Docker service incase if it not started automatically after the installation:

# systemctl start docker.service
# systemctl enable docker.service


Once the service is started, verify your installation by running the following command:

# docker run -it rhel echo Hello-World


This command will look for an image named “rhel” on your local machine, and in its absence, try to download it from the The “” is a central repository of Docker images. Please note that you must have a valid Red Hat subscription to access the download.


Creating a Docker container for JBoss EAP 6.4

Now that we have a basic understanding of what Docker we will learn how to deploy applications by using Docker Files. Dockerfile has a special mission: automation of Docker image creation. A Dockerfile consists of a set of commands which can be written in a text file named “Dockerfile”. The purpose of our Docker file will be adding an application named “myapp.war” in the deployments folder of the standalone installation. Now lets look at the Dockerfile:

# dockerfile to build image for JBoss EAP 6.4

# start from rhel 7.2
FROM rhel

# file author / maintainer
MAINTAINER "FirstName LastName" ""

# update OS
RUN yum -y update && \
yum -y install sudo openssh-clients telnet unzip java-1.8.0-openjdk-devel && \
yum clean all

# enabling sudo group
# enabling sudo over ssh
RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
sed -i 's/.*requiretty$/Defaults !requiretty/' /etc/sudoers

# add a user for the application, with sudo permissions
RUN useradd -m jboss ; echo jboss: | chpasswd ; usermod -a -G wheel jboss

# create workdir
RUN mkdir -p /opt/rh

WORKDIR /opt/rh

# install JBoss EAP 6.4.0
ADD /tmp/
RUN unzip /tmp/

# set environment
ENV JBOSS_HOME /opt/rh/jboss-eap-6.4

# create JBoss console user
RUN $JBOSS_HOME/bin/ admin admin@2016 --silent
# configure JBoss
RUN echo "JAVA_OPTS=\"\$JAVA_OPTS -Djboss.bind.address=\"" >> $JBOSS_HOME/bin/standalone.conf

# set permission folder
RUN chown -R jboss:jboss /opt/rh

# JBoss ports
EXPOSE 8080 9990 9999

# start JBoss
ENTRYPOINT $JBOSS_HOME/bin/ -c standalone-full-ha.xml

# deploy app
ADD myapp.war "$JBOSS_HOME/standalone/deployments/"

USER jboss
CMD /bin/bash


Make sure that the myapp.war application and  are in the same folder as the Dockerfile:

[root@jboss ~]# ls
Dockerfile  myapp.war


If you do not already have the ZIP archive for JBoss EAP 6.4 then you should go download it here.


Building the container

To build a new Docker image is simple, you have to choose a tag and issue a docker build command:

# docker build -q --rm --tag=jboss-myapp


Now check images by issuing a docker command:

[root@jboss ~]# docker images

REPOSITORY                                                  TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

jboss-myapp                                                 latest              bd14a8aad563        2 days ago          912.7 MB


Once the image has completed building, you will want to run it.

# sudo docker run -it jboss-myapp
22:23:51,316 INFO  [org.xnio] (MSC service thread 1-8) XNIO Version 3.0.13.GA-redhat-1

22:23:51,342 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.0.13.GA-redhat-1

22:23:51,353 INFO  [] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)

22:23:51,416 INFO  [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 3.3.4.Final-redhat


The application server will start.


Now we need to find the IP address which has been chosen by Docker to bind the application server:


[root@jboss ~]# docker ps
CONTAINER ID        IMAGE                    COMMAND                     

65009707e8b4           jboss-myapp         "/bin/sh -c '$JBOSS_H"   


CREATED                   STATUS                 PORTS                                               NAMES

17 seconds ago            Up 13 seconds       8080/tcp, 9990/tcp, 9999/tcp    clever_jones

[root@jboss ~]# docker inspect -f '{{ .NetworkSettings.IPAddress }}' 65009707e8b4


Your application is ready on address





Connect with Red Hat Consulting, Training, Certification

Learn more about Red Hat Consulting
Learn more about Red Hat Training
Learn more about Red Hat Certification
Subscribe to the Training Newsletter
Follow Red Hat Training on Twitter
Like Red Hat Training on Facebook
Watch Red Hat Training videos on YouTube
Follow Red Hat Certified Professionals on LinkedIn

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s