RubyMine 2017.1 Help

Docker

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.
    /help/img/idea/2017.1/docker_configuration.png

    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 | /help/img/idea/2017.1/add.png | 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 /help/img/idea/2017.1/add.png to create a Docker configuration:
    /help/img/idea/2017.1/rm_docker_settings.png
  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:

/help/img/idea/2017.1/rm_choose_docker.png

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 .
/help/img/idea/2017.1/rm_docker_run_config.png

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

/help/img/idea/2017.1/rm_docker_run_config1.png

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:

/help/img/idea/2017.1/rm_docker_run_config2.png

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

/help/img/idea/2017.1/rm_docker_app_servers_tw.png

See Also

Last modified: 23 March 2017