RubyMine 2016.2 Help

Docker

Prerequisites

Make sure that the following prerequisites are met:

Overview of Docker support

The Docker integration plugin adds the following to RubyMine:

  • Docker configurations. These are named sets of settings for accessing the Docker Remote API.
  • Docker Deployment run/debug configurations. They let you download and build Docker images, and create and start Docker containers. Application debugging is supported only for Ruby.
  • Docker tool window that lets you manage your Docker images and containers.
  • Docker Registry configurations that represent your Docker image repository user accounts.

Working with Docker: Process overview

  1. Install Docker and start the Docker daemon (on Windows and OS X - along with the Docker VM in which it runs). For corresponding instructions, see Get Started with Docker.
  2. Create a Docker configuration. You can do that:
    • Separately, in the Settings / Preferences dialog: Ctrl+Alt+S add | Docker.
    • When creating a Docker Deployment run configuration: Run | Edit Configurations | add | Docker Deployment, etc.
  3. Create a Docker Deployment run configuration.
  4. Execute the run configuration.
  5. Use the Docker Tool Window to manage your Docker images, containers and deployed applications.

RubyMine and Docker integration configuration

At this point you have Docker and Docker Integration 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 Docker page under Build, Execution, Deployment, and click add to create a Docker configuration:
    docker_settings
  2. In the Docker - 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 with 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: 30 November 2016