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:
- Plugin Docker integration is installed.
The plugin is not bundled with RubyMine, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Overview of Docker support
- 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.
- 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
- 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.
- Create a Docker configuration. You can do that:
- Create a Docker Deployment run configuration.
- Execute the run configuration.
- 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
- Open the Docker Quickstart Terminal application. Docker will launch a default VM providing output in the console:
- 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
Configuring RubyMine to work with Docker
- In the Settings / Preferences dialog, open the Docker page under Build, Execution, Deployment, and click to create a Docker configuration:
- In the Docker - Docker page, provide the following information:
- Name. Here it is Docker.
- API URL. Here it is https://192.168.99.100:2376. This value is taken from the console output (in the
second step of the previous procedure.)
Pay attention to the protocol change:
tcp(in the second step of the previous procedure) has changed to
- Certificates folder. Here it is
- 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.
- 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.
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
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:
The Application Servers Tool Window opens, updating you on the provisioning status and the current state of all your Docker containers:
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.
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.