Basic Docker Tooling Configuration for JBoss Developer Studio 9.x and 10.x
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 and newer includes the Docker tooling out of the box. This article introduces the basic usage for the Docker tooling, such as:
- Prerequisites for Docker Tooling
- Pulling Docker Images from a Docker Registry
- Managing Docker Containers
Prerequisites for Docker Tooling
Ensure that the following prerequisites are met when using the Docker tooling with the JBoss Developer Studio 9:
- Install and set up JBoss Developer Studio 9.0 or higher.
- Install and set up Docker.
- Establish a connection to a Docker daemon within JBoss Tools as follows:
a. Click Window → Show View → Other...
b. In the View window, type docker in the filter text box to view Docker-related options in the list.
c. Expand the Docker item in the results and select Docker Explorer.
d. 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.
e. In the Connect to a Docker daemon wizard:
i. Use the default value or set a desired connection name in the Connection Name field.
ii. Check the Use custom connection settings field.
iii. Add the relevant socket information for your host. If you are unsure about this step, use the default Unix socket Location value.
iv. Click Test Connection to test the connection.
v. When a connection is successfully established, the following message appears:
vi. This message indicates that the Docker daemon connection is successfully established.
Pulling Docker Images from a Docker Registry
The following instructions detail how to pull a new WildFly Docker Image from the JBoss registry.
- Click Window → Show View → Other….
- Type Docker in the filter text field to view Docker-related options in the list.
- Expand the Docker entry and double click Docker Images.
- 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:
a. Click the Pull Image icon at the top bar of the Docker Images view.
b. In the resulting wizard, type jboss/wildfly and click Finish.
c. 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:
Result: You have now pulled a new image for Wildfly from the JBoss registry and run the Docker Image.
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.
- Click Window → Show View → Other….
- Type Docker in the filter text field to view Docker-related options in the list.
- In the search results, expand the Docker entry and double-click Docker Containers.
- The Docker Containers view appears, displaying a list of all containers running on the Docker host.
- Click the desired container to select it. You can now manage your containers using the following operations:
a. Click the pause button from the icons on the top right corner of the view to pause the container.
b. Click the green triangle icon in the row to unpause the container.
c. To view the container logs, right click the container name and click Display Log.
d. 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 thedefault unix:///var/run/docker.sock
configuration file.
- Run Eclipse as root. This solution avoids the problem but is not the recommended solution.
Comments