RubyMine 2017.3 Help

Docker

The following is only valid when Docker Integration and Ruby Docker plugins are installed and enabled!

Prerequisites

Make sure that the following prerequisites are met:

  • Docker is installed, as described on the page Docker Docs. You can install Docker on the various platforms:
    • Windows
    • macOS
    • Linux (Ubuntu, other distributions-related instructions are available as well)
  • Before you start working with Docker, make sure that Docker integration plugin is installed and enabled. The plugin is not bundled with RubyMine.

  • Before you start working with Docker, make sure that the Ruby Docker plugin is enabled. The plugin is bundled with RubyMine and is activated by default. If the plugin is not activated, enable it on the Plugins page of the Settings / Preferences Dialog as described in Enabling and Disabling Plugins.

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 Engine API and Docker Compose.
    docker configuration

    You can create a Docker configuration in two ways:

  • Create Docker Deployment run/debug configurations. They let you download and build Docker images, and create and start Docker containers.

    To create a Docker Deployment run/debug configuration, do the following: Run | Edit Configurations | add | Docker Deployment. See the run configuration settings.

  • Docker tool window (View | Tool Windows | Docker) that lets you manage your Docker images and containers.
  • Docker Registry configurations that represent your Docker image repository user accounts.

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.

Launch Docker as described in the Docker Documentation.

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:
    rm docker settings
  2. In the Docker page, provide the following information:
    • Name. Here it is MyDocker.
    • API URL. Here it is http://localhost:2375.
    • Certificates folder. Here it is /Users/<user name>/.docker/machine/machines/default
  3. Apply the changes and close the Settings / Preferences dialog.

After that, you can configure a remote interpreter using Docker:

rm choose docker

Creating a Docker Deployment run/debug configuration

Having set up Docker, create the run/debug configuration. The Docker Deployment run/debug configuration can be used to download and build the Docker images, to create and start the Docker containers.

First, in the Deployment tab of the Docker Deployment run/debug configuration dialog, specify the following:

  • Name. Here it is Start Docker.
  • Server. Here Docker server is selected from the drop-down list.
  • Deployment. Here Docker Image is selected.
  • Image ID. Here it is mysite.
  • Container. Here it is Docker .
rm 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

rm docker run config1

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

Working with Docker in RubyMine

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

rm docker run config2

The Docker tool window opens, updating you on the provisioning status and the current state of all your Docker containers.

rm docker app servers tw
Last modified: 29 November 2017

See Also