RubyMine 2017.3 Help

Using Docker as a Remote Interpreter

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


RubyMine integration with Docker allows you to run your applications in the variously configured development environments deployed in Docker containers.


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, but here we'll use the mac OS installation.

    Note that you might want to repeat this tutorial on different platforms; then use Docker installations for Windows and Linux (Ubuntu, other distributions-related instructions are available as well).

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

Preparing an example

Go to VCS | Checkout from Version Control, then point to Git:

rm connect to git sample

Enter the repository's URL and click Test just in case... Your connection is successful! Next, click Clone to download the project from GitHub. RubyMine asks you whether you want to open the directory - answer Yes.

Then, open the file routes.rb (Ctrl+Shift+N) and add the following code:

root :to => 'projects#index'

Configuring Docker as a remote interpreter

Now that we've prepared our example, let's define a Docker-based remote interpreter.

To do it, open the Preferences dialog (press Ctrl+Alt+S or click settings on the main toolbar).

Next, click the Ruby SDK and Gems page. On this page, click + and choose New remote...:

rm choose remote

In the dialog box that opens, select the Docker option, from the drop-down lists select the Docker server (if the server is missing, click New...) and image name. If the image is missing, in the Terminal execute the following commands:

docker build .
and then
docker tag <image ID> docker_rails_sqlite

By the way, RubyMine suggests an intention action in the Gemfile for running the docker build . command.

Ruby interpreter path should have the default value:

rm choose docker

As a result, in the Preferences dialog, Ruby SDK from the Docker container should appear in the list of available SDKs, marked with the 'Remote' prefix. Later, you have to select this new interpreter as the project interpreter, by selecting the corresponding radio-button:

rm docker interpreter

Apply changes and close the dialog.

Running your application in a Docker container

As we have a Rails application, we should choose the environment (here it's Production) and execute the Rake command for migrations (db:migrate) in the Production environment. Next, select the Rails server for Production environment run/debug configuration and click run:

The Run tool window shows the output:

rm docker rails run

Follow the suggested link, and see:

rm docker rails run output

Debugging your application in a Docker container

Next, let's debug our application. For that, let's put a breakpointto projects_controller.rb file, to the line @projects = Projects.all, then click debug button next to the run/debug configurations selector.

rm docker debug

Docker tool window

But is it possible to see all the containers without the Terminal? RubyMine says - yes. You can use the Docker Tool Window as the UI for the Docker command-line client.

If you have configured Docker as a remote interpreter, you will see the Docker tool window button at the bottom side of the main RubyMine window:

rm docker tool window button

Click this button and see that the Docker tool window opens:

rm docker tool window

Let's look at this tool window more attentively. What do we see here?

  • First, we are connected to a Docker daemon:
    rm docker tool window connected
  • Second, if we open the Run tool window, we'll see that the contents of the Console tab of the Run tool window is the same as the contents of the Log tab of the Docker tool window:
    rm correspondence between docker and run tool window
  • Third, in the Docker tool window the running container log shows the same output as the Debug tool window console:
    rm docker running container
  • And finally, we see the strange names of the containers - they are human-readable and generated by Docker itself.


Let's summarize what has been done with the help of RubyMine:

  • We downloaded a Rails project from GitHub and opened it.
  • We configured the remote interpreter.
  • We ran our Rails project in the Docker container.
  • Finally, we launched the Docker tool window and saw all the details visible in the Terminal.
Last modified: 11 January 2018

See Also