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
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 registry.access.redhat.com. The "registry.access.redhat.com" is a central repository of Docker images. Please note that you must have a valid Red Hat subscription to access the download.
Quer aprender mais sobre a Universal Base Image (UBI) da Red Hat?
Quer aprender mais sobre a Universal Base Image (UBI) da Red Hat?
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" "emailaddress@gmail.com"
# 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 jboss-eap-6.4.0.zip /tmp/jboss-eap-6.4.0.zip
RUN unzip /tmp/jboss-eap-6.4.0.zip
# set environment
ENV JBOSS_HOME /opt/rh/jboss-eap-6.4
# create JBoss console user
RUN $JBOSS_HOME/bin/add-user.sh admin admin@2016 --silent
# configure JBoss
RUN echo "JAVA_OPTS=\"\$JAVA_OPTS -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0\"" >> $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/standalone.sh -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 jboss-eap-6.4.0.zip are in the same folder as the Dockerfile:
[root@jboss ~]# ls
Dockerfile jboss-eap-6.4.0.zip 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 [org.jboss.as.server] (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
172.17.0.2
Your application is ready on address http://172.17.0.2:8080/myapp.
-----
References
-----
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
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License
Sobre o autor
Navegue por canal
Automação
Últimas novidades em automação de TI para empresas de tecnologia, equipes e ambientes
Inteligência artificial
Descubra as atualizações nas plataformas que proporcionam aos clientes executar suas cargas de trabalho de IA em qualquer ambiente
Nuvem híbrida aberta
Veja como construímos um futuro mais flexível com a nuvem híbrida
Segurança
Veja as últimas novidades sobre como reduzimos riscos em ambientes e tecnologias
Edge computing
Saiba quais são as atualizações nas plataformas que simplificam as operações na borda
Infraestrutura
Saiba o que há de mais recente na plataforma Linux empresarial líder mundial
Aplicações
Conheça nossas soluções desenvolvidas para ajudar você a superar os desafios mais complexos de aplicações
Programas originais
Veja as histórias divertidas de criadores e líderes em tecnologia empresarial
Produtos
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Red Hat Cloud Services
- Veja todos os produtos
Ferramentas
- Treinamento e certificação
- Minha conta
- Suporte ao cliente
- Recursos para desenvolvedores
- Encontre um parceiro
- Red Hat Ecosystem Catalog
- Calculadora de valor Red Hat
- Documentação
Experimente, compre, venda
Comunicação
- Contate o setor de vendas
- Fale com o Atendimento ao Cliente
- Contate o setor de treinamento
- Redes sociais
Sobre a Red Hat
A Red Hat é a líder mundial em soluções empresariais open source como Linux, nuvem, containers e Kubernetes. Fornecemos soluções robustas que facilitam o trabalho em diversas plataformas e ambientes, do datacenter principal até a borda da rede.
Selecione um idioma
Red Hat legal and privacy links
- Sobre a Red Hat
- Oportunidades de emprego
- Eventos
- Escritórios
- Fale com a Red Hat
- Blog da Red Hat
- Diversidade, equidade e inclusão
- Cool Stuff Store
- Red Hat Summit