How-to use Docker with Gogland Go IDE

If you’re on macOS follow these steps.

Install socat

brew install socat

If you don’t have the brew command, checkout brew.sh

Create TCP listener

socat -d -d TCP-L:8044,fork UNIX:/var/run/docker.sock

This creates a TCP port on 8044 that is mapped to the socket that Docker is running on.
Tip: In your ~/.bash_profile file make an alias to easily create the listener at anytime. Example:

alias dockertcp="socat -d -d TCP-L:8044,fork UNIX:/var/run/docker.sock"

Now anytime you want to create the listener simply run dockertcp from a Terminal.

Configure Gogland

To get to the Docker configuration go to Preferences / Build, Execution, Deployment / Docker.

Set your API URL to tcp://localhost:8044
I had to leave the Certificates folder blank in order for it to work for me.

And you should be all set!

BTW these instructions should work for all of Jetbrains IDE products including PyCharm, WebStorm, etc.

Update 2017-03-30

The latest Jetbrains products no longer require you to use SOCAT. Instead enter UNIX:/var/run/docker.sock directly in the API URL box.