Hai semuanya, di materi kali ini kita akan membahas tentang Manage service dan application pada Docker menggunakan IntelliJ IDEA. Diantaranya yang akan kita bahas yaitu

  1. Introduction
  2. Enable Docker support to IntelliJ IDEA
  3. Managing docker images
  4. Running containers
  5. Interation to container

Ok langsung aja kita ke pembahasan yang pertama

Introduction

Jetbraint IntelliJ IDEA adalah salah satu Integrated Development Environment (IDE) favorite saya selama ini, biasanya saya gunakan untuk Coding, Database, dan lain-lain.

Enable Docker support to IntelliI IDEA

Untuk meng-aktifkan Docker support di IntelliJ IDEA kita perlu install plugin docker dari marketplace Jetbraint, by default jika temen-temen menggunakan Ultimate Edition plugin docker tersebut sudah ter-install di IntelliJ IDEA, sedangkan untuk community edition temen-temen perlu install secara manual di Menu -> Settings -> Plugins -> Marketplace seperti berikut

marketplace-docker

Setelah ter-install, kita akan configure supaya docker dan IntelliJ IDEA terintegrasi, kita masuk ke Menu -> Settings -> Build, Execution, dan Deployment -> Docker seperti berikut:

marketplace-docker

Jika di IDEA temen-temen belum ada konfigurasi tersebut, bisa klik + untuk menambahkan Docker server baru, Kemudian konfigurasi sesuai dengen kebutuhan contohnya connection lewat ssh, atau lewat tcp dan lain-lain. Jika sudah OK nanti di bawah akan ada connection statusnya seperti gambar tersebut Connection successful dan yang terkahir kita bisa Apply konfigurasinya. Maka jika buka tab Services hasilnya seperti berikut:

jetbraint-services

Managing images

Images are distributed via the Docker registry. Docker Hub is the default public registry with all of the most common images: various Linux flavors, database management systems, web servers, runtime environments, and so on. There are other public and private Docker registries, and you can also deploy your own registry server.

  1. Configure a docker registry config-docker-registry
  2. Pull an image from docker registry manage-image-pull
  3. Build an image from a Dockerfile
  4. Push an image to a Docker registry manage-image-push

Running containers

Docker containers are runtime instances of the corresponding images. IntelliJ IDEA uses run configurations to execute the commands that build Docker images and run containers. There are three types of Docker run configurations:

  1. Docker Image: Created automatically when you run a container from an existing image. You can run it from a locally existing Docker image that you either pulled or built previously. run-from-image

  2. Dockerfile: Created automatically when you run a container from a Dockerfile. This configuration builds an image from the Dockerfile, and then derives a container from this image.

  3. Docker-compose: Created automatically when you run a multi-container Docker application from a Docker Compose file. run-from-compose-files

Interation to container

Created containers are listed in the Services tool window. By default, the Services tool window displays all containers, including those that are not running. To hide stopped containers from the list, click The Filter button in the toolbar, select Docker, and then click Stopped Containers to remove the checkbox.

When you select a container, you can view the following tabs by default:

  1. Build Log, Shows the deployment log produced by the corresponding Docker run configuration while building the image for the container. interaction-build-logs
  2. Log, Shows the log messages from the container’s standard output streams: STDOUT and STDERR. interaction-logs
  3. Properties, Shows the name and ID of the container, and the ID of the corresponding image. interaction-properties
  4. Environment Variables, Shows the environment variables configured for the container. interaction-env-vars
  5. Port Bindings, Show the port bindings configured for this container. interaction-port-binding
  6. Volume Bindings, Show the volume bindings configured for this container. interaction-volume-binding
  7. Files, Browse the files inside a running container. interaction-files
  8. Execute a command inside a running container interaction-exec