Docker & Eclipse

Docker & Eclipse

Docker and Eclipse

This chapter will show you basic Docker tooling with Eclipse:

  • Pull/Push/Build Docker images
  • Run/Start/Stop/Kill Docker containers
  • Customize views

Install Docker Tooling in Eclipse

Downlaod Eclipse for Java Developer and Install.

Go to “Help” menu, “Install New Software...”.

Select Eclipse update site for the release, search for Docker, select “Docker Tooling”.

My Image

Click on “Next>”, “Next>”, accept the license agreement, click on “Finish” to start the installation.

Restart Eclipse for the installation to complete.

Docker Perspective and View

Go to “Window”, “Perspective”, “Open Perspective”, “Other...”, “Docker Tooling”.

My Image

Click on “OK” to see the perspective.

My Image

This has three views:

  • Docker Explorer: a tree view listing all connected Docker instances, with image and containers.
  • Docker Images: a table view listing containers for selected Docker connection.
  • Docker Containers: a table view listing containers for selected Docker connection

Click on the text in Docker Explorer to create a new connection. If you are on Mac/Windows, you are likely using Docker for Mac/Windows or Docker Toolbox to setup Docker Host. Eclipse allows to configure Docker Engine using both Docker for Mac/Windows and Docker Toolbox.

If you are using Docker for Mac/Windows, then the default values are shown:

My Image

Click on “Test Connection” to test the connection.

My Image

If you are using Toolbox, enter the values as shown:

My Image

The exact value of TCP Connection can be found using docker-machine ls command. The path for authentication is the directory name where certificates for your Docker Machine, couchbase in this case, are stored.

Click on “Test Connection” to make sure the connection is successfully configured.

My Image

In either case, the configuration can be completed once the connection is tested. Click on “Finish” to complete the configuration.

Docker Explorer is updated to show the connection.

Containers and Images configured for the Docker Machine are shown in tabs. They can be expanded to see the list in Explorer itself.

Pull an Image

Expand the connection to see “Containers” and “Images”.

Right-click on “Images” and select “Pull...”.

Type the image name and click on “Finish”.

My Image

This image is now shown in Explorer and Docker Images tab.

My Image

Any existing images on the Docker Host will be shown here.

Run a Container

Select an image, right-click on it, and click on “Run...”. It shows the options that can be configured for running the container. Some of them are:

  • Publish ports on Docker host interface (-P or -p in docker run command)
  • Keep STDIN open and allocate pseudo-TTY (-it on CLI)
  • Remove container after it exits (--rm on CLI)
  • Volume mapping (-v on CLI)
  • Environment variables (-e on CLI)

Uncheck “Publish all exposed ports” box to map to corresponding ports.

My Image

Click on “Finish” to run the container.

Right-click on the started container, select “Display Log” to show the log.

My Image

The container can be paused, stopped and killed from here as well.

To see more details about the container, right-click on the container, select “Show In”, “Properties”.

My Image

Build an Image

In Docker Images tab, click on the hammer icon on top right.

Give the image name, specify an empty directory, click on “Edit Dockerfile” to edit the contents of Dockerfile

My Image

Click on “Save” and “Finish” to create the image.



Last modified February 6, 2023: Added Java and Go (634c865)