How to run a wildfly server inside docker

Before we begin you must configure docker, I am using Ubuntu so I followed the guide here: Choose the appropriate OS that applies to you.

Let's do this in sequence:

  1. Checkout and compile the very basic javaee war from
  2. In Ubuntu create a new folder: wildfly-hello:
    >mkdir wildfly-hello
  3. Copy hello-javaee.war inside wildfly-hello.
  4. Create a Dockerfile and insert the lines below inside the same folder.

    from jboss/wildfly
    run /opt/jboss/wildfly/bin/ admin admin@1234 --silent
    add hello-javaee.war /opt/jboss/wildfly/standalone/deployments/
    cmd ["/opt/jboss/wildfly/bin/", "-b", "", "-bmanagement", ""]
  5. Inside the wildfly-hello folder build the Dockerfile.
    >docker build -it wildfly-hello .
  6. Run the docker image
    >docker run wildfly-hello
  7. Get the ip address of the container by:
    >docker ps - to get the container id
    >docker inspect -f '{{ .NetworkSettings.IPAddress }}' CONTAINER_ID
  8. Now we should have the ip address of docker, we can now open wildfly in the browser.
What does the lines in step 3 means?
-from is a docker keyword use to import an image from docker hub
-run is a command that runs an executable file, in this case we are adding a user with application management role
-add lets us add a file inside the container
-cmd tells the docker to execute this by default, when we execute docker run
How to run a wildfly server inside docker How to run a wildfly server inside docker Reviewed by Edward Legaspi on Friday, December 16, 2016 Rating: 5

No comments:

Powered by Blogger.