Upcoming Docker Tooling for Eclipse gave a preview of Docker Tooling coming in Eclipse. This Tech Tip will show how to get started with it.
NOTE: This is pretty bleeding edge and so some of the features may be half baked. But we are looking for all the feedback we can get!
The Docker tooling is aimed at providing at minimum the same basic level features as the command-line interface, but also provides some advantages by having access to a full fledged UI.
Install Docker Tools Plugins
- Download and install JBoss Developer Studio 9.0 Nightly, take defaults throughout the installation. Alternatively, download Eclipse Mars latest build and configure JBoss Tools plugin from the update site http://download.jboss.org/jbosstools/updates/nightly/mars/.
- Open JBoss Developer Studio 9.0 Nightly or Eclipse Mars.
- 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/.
- Expand Linux Tools, select Docker Client and Docker Tooling:
- Click on Next >, Next >, accept the license agreement, and click on Finish. This will complete the installation of plugins.Restart the IDE for changes to take effect.
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.
- Use the menu Window, Show View, Other…. Type “docker” to see the output as:
- Select Docker Explorer to open the explorer.
- Click on the link in this window to create a connection to Docker Host. Specify the settings as shown:Make sure to get IP address of the Docker Host using `docker-machine ip` command.Also, make sure to specify the correct directory for `.docker` on your machine.
- Click on Test Connection to check the connection. This should show the output as:Click on OK and Finish to exit out of the wizard.
- Docker Explorer itself is a tree view that handles multiple connections and provides users with quick overview of the existing images and containers.
- Customize the view by clicking on the arrow in toolbar:
- Built-in filters can show/hide intermediate and dangling images, as well as stopped containers.
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:
- Pull/push images from/to the Docker Hub Registry (other registries will be supported as well, #469306)
- Build images from a Dockerfile
- Create a container from an image
Let’s take a look at it.
- Use the menu Window, Show View, Other…, select Docker Images. It shows the list of images on Docker Host:
- Right-click on the image ending with wildfly:latest and click on the green arrow in the toolbar. This will show the following 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.
- When the container is started, all logs are streamed into Eclipse Console:
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.
- Use the menu Window, Show View, Other…, select Docker Containers. It shows the list of running containers on Docker Host:
- 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.
- Select the paused container, and click on the green arrow in the toolbar to restart the container.
- Right-click on any running container and select Display Log to view the log for this container.
Information and Inspect on Images and Containers
Eclipse Properties view is used to provide more information about the containers and images.
- 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:
- Inspect view is shown as:
The code is hosted in Linux Tools project.
File your bugs at: bugs.eclipse.org/bugs/enter_bug.cgi?product=Linux%20Tools and use “Docker” component. Talk to us on IRC.