Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
205 lines (159 sloc) 7.17 KB

NetBeans

Environment

  1. NetBeans Nightly on Sep 15, 2016

Configure Docker

  1. No support for Docker for Mac, only Docker Machine supported

  2. In Services tab, configure Docker Machine using URL

  3. Click on Test Connection to verify the connection

  4. Show the list of images and containers - running and non-running

Pull Image

  1. Right-click on machine name, click on Pull…​, search for arungupta/couchbase image

    1. Show how images on Doker Hub can be seen here

  2. Show output in Output window

Run Container

  1. Right-click on the downloaded image, select Run…​, take the defaults

    1. Go to browser and show 192.68.99.100:8091 is not accessible (because ports were not exposed)

    2. Stop and remove the container

  2. Run the container again, click on Next>, click on Add Exposed, click on Finish

  3. Show 192.168.99.100:8091

Build Image

  1. Right-click on machine name and cick on Build…​

  2. Provide a directory where Dockerfile already exists and build the image

    1. Provide the image name in Repository

    2. Open Dockerfile using Files to show syntax highlighting

Maven + Dockerfile

  1. Create a new Maven project

  2. Add a new Dockerfile

  3. Go to Files panel, right-click on Dockerfile and show Build…​

Misc

  1. Shutdown the machine and show the offline status in NetBeans

Eclipse

Environment

  1. Tested with Neon.1 RC3 (at the time of this writing)

    1. Make sure to download the complete bundle instead of just the installer

Configure Docker

  1. Help, Install New Software, Neon update site, search for Docker Tooling, finish the install

  2. Switch to Docker Tooling perspective

  3. Explain connection dialog (show how defaults are populated)

    1. Docker Machine

      1. Use docker-machine env to print the environment

      2. Use DOCKER_HOST and DOCKER_CERT_PATH for TCP Connection

      3. Click on Test Connection

    2. Docker for Mac

      1. Start Docker for Mac

      2. Configure using Unix socket. Connection name of moby and socket of unix:///var/run/docker.sock are automatically picked.

      3. Click on Test Connection

  4. Multiple views

    1. Docker Explorer - view for creating/managing connections to Docker daemons

    2. Docker Images- view for managing Docker images

    3. Docker Containers - view for managing Docker containers

    4. Docker Image Hierarchy - image hierarchy for Docker images

    5. Console - Display logs of stdout/stderr output from Containers and in some instances, allow input to stdin

    6. Properties - Detailed information about connections, images and containers

  5. Customize View - show/hide stopped containers

  6. Preferences, Docker, Registry Accounts

    1. Multiple accounts can be setup and used for pushing images to registry with authentication

Pull image

  1. Right-click on node, search for arungupta/couchbase image

  2. Show output in Progress window

  3. Properties of the image in Properties window

Run Container

  1. Right-click on the downloaded image, click on Run

    1. Explain port publishing, container linking (legacy), -it, --rm, data volumes, environment variables, labels, CPU & memory limits

  2. Unselect Publish all exposed ports …​ to map the ports to the same number on the host

  3. Show log in Console

  4. Show 127.0.0.1:8091

  5. Docker Containers pane, show context-sensitive menu on top right. It changes if the container is stopped or running.

  6. Show All containers

  7. Run configurations

    1. Click on Run, Run Configurations, walk through the configuration of containers

  8. Select a container in Docker Containers, in Properties, show Info and Inspect

  9. Docker Compose

    1. Check out a project TODO

    2. Select docker-compose.yml, right-click Run AsDocker Compose

Build Image

  1. In Docker Images view, click on hammer

  2. Provide an image name and directory name (will be created)

  3. Use Dockerfile:

    FROM openjdk:8-alpine
    
    CMD ["/usr/bin/java", "-version"]

    Dockerfile editor is a basic text editor with support for copy/paste but no syntax highlighting

  4. Right-click on the image and select Open Image Hierarchy to show the hierarchy of images

  5. Right-click on the container and click on Run to run the image and see the output:

    2016-09-16T05:24:37.948910862Z openjdk version "1.8.0_92-internal"
    2016-09-16T05:24:37.949566555Z OpenJDK Runtime Environment (build 1.8.0_92-internal-alpine-r1-b14)
    2016-09-16T05:24:37.949876330Z OpenJDK 64-Bit Server VM (build 25.92-b14, mixed mode)
  6. Click on Run Configurations, walk through the configuration in Build Docker Image and Run Docker image.

Misc

  1. Show Preferences, Docker, Logging

IntelliJ IDEA

Download

  1. Download IntelliJ IDEA Community or Ultimate

    1. Tested with 2016.2

Configure Docker

  1. Install plugin

    1. Preferences, Plugins, Install JetBrains plugin…​

    2. Search on Docker, click on Install

    3. Restart IntelliJ

  2. Create a Java project

  3. Create Deployment

    1. Preferences, Build, Execution & Deployment, Clouds

    2. Create a new deployment of type Docker

    3. Use the defaults for Docker Machine

  4. Docker Tooling window

    1. Re-open the project

    2. View, Tool Windows, Docker

    3. Click on Connect or green arrow to connect to Docker Machine

Pull image

  1. Select top-level node

  2. Click on Pull image

    1. Show how multiple registries can be configured

  3. Type arungupta/couchbase and pull

Run Container

  1. Select an image, click on Create container

  2. Select After launch and enter the URL as http://192.168.99.100:8091

  3. Go to Container tab, add Port bindings for 8091:8091

  4. Right-click on the running container and explain the menu items. Show Inspect

  5. Show how to Stop and Delete container from the left menu

Build Image

  1. Refer to the instructions https://www.jetbrains.com/help/idea/2016.2/docker.html

  2. Right-click on the project, create a new directory docker-dir

  3. Create Artifact

    1. Click on top-right for Project Structure

    2. Select Artifacts

    3. Change Type: to Web Application: Archive

    4. Change the name to helloweb

    5. Change Output directory to docker-dir

    6. Click on OK

  4. Create Dockerfile in this directory. Use the contents

    FROM jboss/wildfly
    
    ADD helloweb.war /opt/jboss/wildfly/standalone/deployments/
  5. Run, Edit Configurations, add new Docker Deployment

    1. Change name to helloweb

    2. Deployment tab

      1. Select After launch, change the URL to http://192.168.99.100:18080/helloweb/index.jsp

      2. In Before launch, add Build Artifacts and select the artifact

    3. Container tab

      1. Add Port bindings for 8080:8080

  6. View, Tool Windows, Docker, connect to it

  7. Run the project

Docker Compose

  1. Preferences, Build, Execution, Deployment, Clouds, set the path of docker-compose to /usr/local/bin/docker-compose.

  2. Create a docker-compose.yml in docker-dir

  3. Copy Compose file from https://github.com/arun-gupta/oreilly-docker-book/blob/master/hello-javaee/docker-compose.yml

  4. Create new deployment, select docker-dir/docker-compose.yml in Deployment:

  5. Run the project and show the running containers under Compose