How to use Docker within IntelliJ

by Josef Adersberger | 247 words | ~2 min read

A short tutorial on how to use Docker within intelliJ and with a little help from Gradle. You can find the sample code & the full description here


  • Install IntelliJ Docker plugin
  • Install Docker Machine
  • Check that there is a default Docker Machine: docker-machine ls. If there is no default machine create one: docker-machine create --driver virtualbox default.
  • Start the default Docker Machine: docker-machine start default.`
  • Bind the env vars to the shell: eval "$(docker-machine env default)"
  • Check if everything is correct: docker ps

Using Docker within IntelliJ

  1. Setup Docker cloud provider in intelliJ global preferences as shown below.

Tip: You can get the API URL by executing docker-machine ls and using the shown IP & port for the default machine.

  1. Check connection to Docker daemon in intelliJ “Docker” tab

  1. Create new project from version control using github

  2. Create a new run configuration to deploy application to Docker as shown on the following screenshots:


  • Be sure not to forget to add the Gradle tasks as a “before launch” action as shown at the very bottom of the screenshot.
  • The same is also possible for Docker Compose files. Just point the “Deployment” dropdown to the Docker Compose file.

  1. Run the configuration and inspect the Docker container. A browser will open automagically and point to the REST endpoint. Within intelliJ you can access the containers console output, environment variables, port bindings etc.


The Latest Posts