This is the first of a set of tutorials about the Docker framework. In this one we will learn how to install the Docker platform on a Linux Centos machine and pull and execute a WildFly image on the top of it.
Firstly, what is Docker ? Docker is a container-based software framework for automating deployment of applications. “Containers” are encapsulated, lightweight, and portable application modules. The major (intended) benefit of using a container is that your application will run consistently on and between any server, be it cloud or dedicated, or of varying operating systems.
Installing Docker
The documentation to install Docker is available here: https://docs.docker.com/install/ .
As you can see from the documentation, there are several options to install Docker on your machine. If you want a quick ready to install solution for any Linux machine, simply download the installation script from https://get.docker.com as follows:
$ curl -fsSL https://get.docker.com -o get-docker.sh
Then, execute the script:
$ sh get-docker.sh
If you would like to run Docker as a non-privileged user, you should now consider adding your user to the docker group by executing:
$ sudo usermod $(whoami) -G docker -a
Finally, you will need to log out and log in again. We can check that, effectively, our user is now in the Docker group by checking the output of this command:
$ groups $(whoami)
Great! now your Docker is ready to rock!
Pulling Docker images
Firstly, we will pull the Docker image of WildFly. The latest Docker images of WildFly (27 and newer) are available at quay.io/wildfly/wildfly:latest
Therefore, to pull WIldFly latest image you can run the following command:
docker pull quay.io/wildfly/wildfly:latest
wildfly-centos7 image
The new image quay.io/wildfly/wildfly replaces the image quay.io/wildfly/wildfly-centos7 that is now deprecated.
Next, check that the WildFly Docker image is available in your local Docker repository:
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/wildfly/wildfly latest 832621dbec56 5 days ago 869MB
Then, in order to start the wildfly application server, simply issue:
docker run -it -p 8080:8080 quay.io/wildfly/wildfly
Here is the Console output:
As you can see, the Server has started correctly. Finally, we can check the status of WildFly by executing the “docker ps” command. This command will fetch the Image Status and the Ports engaged by the process:
The server process is running and the port 8080 is being forwarded to all available IP Addresses.
Therefore, you can simply access the application server http listener at localhost:8080
Et volià! WildFly served on a Docker image.
Next tutorial we will discuss how to customize the WildFly Docker image and deploy some applications on the top of it: Running WildFly with Docker
Finally, if you want to check the source code of WildFly Docker image, it is available on GitHub: https://github.com/jboss-dockerfiles/wildfly