Skip to content

Latest commit

 

History

History
145 lines (125 loc) · 5.86 KB

docker-eclipse.adoc

File metadata and controls

145 lines (125 loc) · 5.86 KB

Docker Tools in Eclipse

The Docker tooling is aimed at providing at minimum the same basic level features as the command-line interface, but also provide some advantages by having access to a full fledged UI.

Install Docker Tools Plugins

As this is still in early access stage, you will have to install it first:

  1. Use JBoss Developer Studio 9.0 Beta 2.

    Alternatively, download Eclipse Mars latest build and configure JBoss Tools plugin from the update site http://download.jboss.org/jbosstools/updates/nightly/mars/.

  2. Open JBoss Developer Studio 9.0 Nightly

  3. Add a new site using the menu items: ‘Help’ > ‘Install New Software…​’ > ‘Add…​’.

    Specify the ‘Name:’ as “Docker Nightly” and ‘Location:’ as http://download.eclipse.org/linuxtools/updates-docker-nightly/.

    jbds docker tools1
    Figure 1. Add Docker Tooling To JBoss Developer Studio
  4. Expand Linux Tools, select ‘Docker Client’ and ‘Docker Tooling’.

    jbds docker tools nightly setup
    Figure 2. Add Docker Tooling
  5. Click on ‘Next >’, ‘Next >’, accept the terms of the license agreement, and click on ‘Finish’. This will complete the installation of plugins.

    Restart the IDE for the changes to take effect.

Docker Explorer

The Docker Explorer provides a wizard to establish a new connection to a Docker daemon. This wizard can detect default settings if the user’s machine runs Docker natively (such as in Linux) or in a VM using Boot2Docker (such as in Mac or Windows). Both Unix sockets on Linux machines and the REST API on other OSes are detected and supported. The wizard also allows remote connections using custom settings.

  1. Use the menu ‘Window’, ‘Show View’, ‘Other…​’. Type ‘docker’ to see the output as:

    jbds docker tools docker view
  2. Select ‘Docker Explorer’ to open Docker Explorer.

    jbds docker tools docker explorer view
  3. Click on the link in this window to create a connection to Docker Host. Specify the settings as shown:

    jbds docker tools2
    Figure 3. Docker Explorer

    Make sure to get IP address of the Docker Host as:

    docker-machine ip default

    Also, make sure to specify the correct directory for .docker on your machine.

  4. Click on ‘Test Connection’ to check the connection. This should show the output as:

    jbds docker tools test connection output
    Figure 4. Docker Explorer

    Click on ‘OK’ and ‘Finish’ to exit out of the wizard.

  5. Docker Explorer itself is a tree view that handles multiple connections and provides users with quick overview of the existing images and containers.

    jbds docker tools3
    Figure 5. Docker Explorer Tree View
  6. Customize the view by clicking on the arrow in toolbar:

    jbds docker tools customize view option
    Figure 6. Docker Explorer Customize View

    Built-in filters can show/hide intermediate and ‘dangling’ images, as well as stopped containers.

    jbds docker tools customize view wizard
    Figure 7. Docker Explorer Customize View Wizard

Docker Images

The Docker Images view lists all images in the Docker host selected in the Docker Explorer view. This view allows user to manage images, including:

  1. Pull/push images from/to the Docker Hub Registry (other registries will be supported as well, #469306)

  2. Build images from a Dockerfile

  3. Create a container from an image

Lets take a look at it.

  1. Use the menu ‘Window’, ‘Show View’, ‘Other…​’, select ‘Docker Images’. It shows the list of images on Docker Host:

    jbds docker tools4
    Figure 8. Docker Images View
  2. Right-click on the image ending with “wildfly:latest” and click on the green arrow in the toolbar. This will show the following wizard:

    jbds docker tools run container wizard
    Figure 9. Docker Run Container Wizard

    By default, all exports ports from the image are mapped to random ports on the host interface. This setting can be changed by unselecting the first checkbox and specify exact port mapping.

    Click on ‘Finish’ to start the container.

  3. When the container is started, all logs are streamed into Eclipse Console:

    jbds docker tools5
    Figure 10. Docker Container Logs

Docker Containers

Docker Containers view lets the user manage the containers. The view toolbar provides commands to start, stop, pause, unpause, display the logs and kill containers.

  1. Use the menu ‘Window’, ‘Show View’, ‘Other…​’, select ‘Docker Containers’. It shows the list of running containers on Docker Host:

    jbds docker tools6
    Figure 11. Docker Containers View
  2. Pause the container by clicking on the “pause” button in the toolbar (#469310). Show the complete list of containers by clicking on the ‘View Menu’, ‘Show all containers’.

    jbds docker tools all containers
    Figure 12. All Docker Containers
  3. Select the paused container, and click on the green arrow in the toolbar to restart the container.

  4. Right-click on any running container and select “Display Log” to view the log for this container.

    jbds docker tools display log
    Figure 13. Eclipse Properties View

TODO: Users can also attach an Eclipse console to a running Docker container to follow the logs and use the STDIN to interact with it.

Details on Images and Containers

Eclipse Properties view is used to provide more information about the containers and images.

  1. Just open the Properties View and click on a Connection, Container, or Image in any of the Docker Explorer View, Docker Containers View, or Docker Images View. This will fill in data in the Properties view.

    Info view is shown as:

    jbds docker tools properties info
    Figure 14. Docker Container Properties View Info

    Inspect view is shown as:

    jbds docker tools properties inspect
    Figure 15. Docker Container Properties View Inspect