Menu Close
Settings Close

Language and Page Formatting Options

Red Hat Training

A Red Hat training course is available for Red Hat JBoss Developer Studio

Chapter 5. Developing with Docker

5.1. Configuring Docker Tooling Basics

Docker offers images that can be managed in one of two ways: build/create your own image using a script file, or pull down an existing image file from public or private registries online. This procedure contains instructions for pulling down an image from the JBoss registry. Such registries are useful to share images between developers or between environments to ensure a standardized software stack for development or testing requirements. Once the Docker Container is created and running, users can manage the container.

JBoss Developer Studio 9.0. 0 Beta 1 includes the Docker tooling out of the box. This article introduces the basic usage for the Docker tooling, such as:

5.1.1. Prerequisites for Docker Tooling

Ensure that the following prerequisites are met when using the Docker tooling with the IDE:

  1. Install and set up JBoss Developer Studio 9.0.0 Beta 1 or higher.
  2. Install and set up Docker.
  3. Establish a connection to a Docker daemon from within the IDE:

    1. Click Window > Show View > Other.
    2. In the Show View window, type docker in the filter text box to view Docker-related options in the list.
    3. Expand Docker, click Docker Explorer, and then click Open.
    4. In the Docker Explorer view, if no connection is configured, a message appears stating that No connection to a Docker daemon is available. Click this link to create a new connection. Click the link to start configuring a new Docker daemon connection.

      Figure 5.1. Creating a new Docker Daemon Connection

      Creating a new Docker Daemon Connection
    5. In the Connect to a Docker daemon wizard:

      1. In the Connection Name field, use the default value or set a desired connection name.
      2. Click the Use custom connection settings check box.
      3. Add the relevant socket information for your host. If you are unsure about this step, use the default Unix socket Location value.
      4. Click Test Connection to test the connection.

Result: When a connection is successfully established, the Ping Succeeded message appears.

Figure 5.2. Ping Success Message

Ping Success Message

5.1.2. Pulling Docker Images from a Docker Registry

To pull a new WildFly Docker Image from the JBoss registry:

  1. Click Window > Show View > Other.
  2. Type Docker in the filter text field to view Docker-related options in the list.
  3. Expand Docker and double-click Docker Images.
  4. In the Docker Images view, locate the entry that ends with wildfly:latest. If this entry is not listed, pull the Wildfly image as follows:

    1. In the Docker Images view, click the Pull icon.
    2. In the Pull Image wizard, Image name field, type jboss/wildfly and click Finish.

      Figure 5.3. Pulling the WildFly Image from JBoss Registry

      Pulling the WildFly Image from JBoss Registry

      Result: The bottom right corner displays the progress as the image is pulled down from the registry. When the pulling process completes, the appropriate entry appears in the Docker Images list.

Figure 5.4. The Docker WildFly Image

The Docker WildFly Image

5.1.3. Managing Docker Containers

Docker containers are isolated processes that are based on Docker Images. Once created, users can stop, start, pause, unpause, kill, or remove the containers, or read their logs.

To manage the Docker Containers:

  1. Click Window > Show View > Other.
  2. Type Docker in the filter text field to view Docker-related options in the list.
  3. Expand Docker and double-click Docker Containers. The Docker Containers view appears displaying a list of all containers running on the Docker host.
  4. Click the desired container to select it. You can now manage your containers using the buttons in the Docker Container view header:

    1. To pause the container, click the Pause button.
    2. To start the container, click the Start button.
    3. To view the container logs, right click the container name and click Display Log.
    4. To view a list of all containers, click on the right-most icon in the list of icons in the view, which displays a drop-down option to view all containers. Click this option to view all available containers.

Result: You have performed various management operations on your Docker container.

5.1.4. Troubleshooting

Attempting to connect to a running local Docker instance as a non-root user results in errors being logged, but not displayed in the User Interface, which results in the error being non-obvious. The following workarounds are available for this problem:

  • Connect to the Docker instance manually. Define a custom configuration file and specify the TCP URL displayed by the systemctl status docker service. As an example, you can use a TCP URL such as tcp:// to connect to the running Docker instance instead of the default unix:///var/run/docker.sock configuration file.

    Figure 5.5. Connect to a Docker Daemon

    Connect to a Docker Daemon
  • Run Eclipse as root. This solution avoids the problem but is not the recommended solution.