A JBoss Project
Red Hat

How To:

Basic Docker Usage

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 Tools 4.3.0 Beta1 includes the Docker tooling out of the box. This article introduces the basic usage for the Docker tooling, such as:

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 Tools 4.3.0 Beta1 or higher.

  2. Install and set up Docker.

  3. Establish a connection to a Docker daemon within JBoss Tools as follows:

    1. Click Window ▸ Show View ▸ Other…​.

    2. In the View window, type docker in the filter text box to view Docker-related options in the list.

    3. Expand the Docker item in the results and select Docker Explorer.

    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.

      No connection to a Docker daemon is available
      Figure 1. No Connection to a Docker Daemon is Available
    5. In the Connect to a Docker daemon wizard:

      1. Use the default value or set a desired connection name in the Connection Name field.

      2. Check the Use custom connection settings field.

      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.

      5. When a connection is successfully established, the following message appears:

        Ping Success Message
        Figure 2. Ping Success Message
      6. This message indicates that the Docker daemon connection is successfully established.

2. Pulling Docker Images from a Docker Registry

The following instructions detail how 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 the Docker entry and double click Docker Images.

  4. In the listed entries for 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. Click the Pull Image icon at the top bar of the Docker Images view.

    2. In the resulting wizard, type jboss/wildfly and click finish.

      Pull WildFly Image from JBoss Registry
      Figure 3. Pull WildFly Image from JBoss Registry
    3. 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 on the Docker Images list as follows:

      The Docker WildFly Image
      Figure 4. The Docker WildFly Image

      Result: You have now pulled a new image for Wildfly from the JBoss registry and run the Docker Image.

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.

  1. Click Window ▸ Show View ▸ Other…​.

  2. Type Docker in the filter text field to view Docker-related options in the list.

  3. In the search results, expand the Docker entry and double-click Docker Containers.

  4. The Docker Containers view appears, displaying a list of all containers running on the Docker host.

  5. Click the desired container to select it. You can now manage your containers using the following operations:

    1. Click the pause button from the icons on the top right corner of the view to pause the container.

    2. Click the green triangle icon in the row to unpause the container.

    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.

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://0.0.0.0:2375 to connect to the running Docker instance instead of the default unix:///var/run/docker.sock configuration file.

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

back to top