RubyMine 8.0 Help

Docker

You can add Docker support to RubyMine by installing the Docker integration plugin.

Prerequisites

Make sure that the following prerequisites are met:

RubyMine and Docker integration configuration

At this point you have Docker and Docker plugin for RubyMine installed, so we can start with integration configuration.

Launching default Docker machine and getting necessary parameters

  1. Open the Docker Quickstart Terminal application. Docker will launch a default VM providing output in the console:
    docker_vm_console
  2. In the Docker console, run the console command docker-machine env default. Thus you will get all the necessary parameters - you'll need them later for RubyMine configuration (such as DOCKER_HOST and DOCKER_CERT_PATH):
    docker_vm_console_params

Configuring RubyMine to work with Docker

  1. In the Settings / Preferences dialog, open the Clouds page under Build, Execution, Deployment, and click add to create a Docker configuration:
    docker_settings
  2. In the Clouds - Docker page, provide the following information:
    docker_settings1
  3. Apply the changes and close the Settings / Preferences dialog.

Creating a Docker Deployment run/debug configuration

Having set up Docker, create the run/debug configuration.

First, in the Deployment tab, specify the following:

  • Name. Here it is Start Docker.
  • Server. Here Docker server is selected from the drop-down list.
  • Deployment method. Here Dockerfile is selected.
  • Image tag. Here it is mysite.
  • Container name. Here it is Docker_Xdebug.
docker_run_config

Next, in the Container tab, specify the necessary parameters.
At this point we are interested in exposing 80 port of the container to be available from our local machine, so we should configure a port binding for that:

Container port: 80, Protocol: tcp, Host IP: empty, Host port: 8080

docker_run_config1

Apply changes and close the Docker Deployment run/debug configuration dialog.

Working Docker in RubyMine

Running Docker from RubyMine

As all the tools are installed, and the integration is configured, the recently created Start Docker Run/Debug Configuration can be launched:

docker_run_config2

The Application Servers Tool Window opens, updating you on the provisioning status and the current state of all your Docker containers:

docker_app_servers_tw

Managing Docker containers and other Docker-related actions in RubyMine

From the Application Servers Tool Window, it’s easy to inspect containers and view running processes. RubyMine also enables you to search through the logs, start and stop containers, and perform basic container management like creating and deleting containers. Each deployment in Docker is assigned a unique container ID - these are initially temporary containers, although they can be committed and saved for further distribution. On the Docker Hub registry, there are many such images available for you to try.

docker_app_servers_tw1

Images in Docker are read-only - once committed, any changes to a container’s state will become part of a new image. When you have a stable build on one instance of Docker (on your development machine, staging server, or a cloud), reproducing the exact same build is as simple as (1) committing the Docker container, (2) pushing it to a registry (public or private), then (3) pulling the same image to another instance of Docker, running - wherever.

docker_app_servers_tw2

See Also

Last modified: 10 December 2015