I do not use a docker machine. The problem was that TCP access to the docker API was not installed by default in ubuntu 16.04.
There are suggestions for enabling TCP / IP access.
However, JetBrains gave me the simplest solution:
If you use Linux, most likely Docker is installed with its default setting and Docker is expected to be used via UNIX domain socket /var/run/docker.sock. And you should specify unix: ///var/run/docker.sock in the API URL field. Please comment if this helps!
This suggestion worked with my Ubuntu 16.04 distribution.
This is included in the Docker entry in the PyCharm settings in the Build, Execution, Deployment section.
You can also edit this when setting up the remote interpreter, but only by creating a new Docker entry.
TCP / IP Method
This method works if you want access to TCP / IP, but it is a security risk. The socket approach is better, which is probably why it is by default.
https://coreos.com/os/docs/latest/customizing-docker.html
Docker setup
The Docker systemd module can be configured by overriding the device that comes with the default CoreOS settings. Common use cases are described below.
Include remote API in new socket
Create a file called / etc / systemd / system / docker -tcp.socket to make Docker available on the TCP socket on port 2375.
[Unit] Description=Docker Socket for the API [Socket] ListenStream=2375 BindIPv6Only=both Service=docker.service [Install] WantedBy=sockets.target
Then enable this new socket:
systemctl enable docker-tcp.socket systemctl stop docker systemctl start docker-tcp.socket systemctl start docker
Check that his work:
docker -H tcp://127.0.0.1:2375 ps
As soon as I decided to find ubuntu 16.04, I came across simpler solutions, but I did not test them.
For example:
https://www.ivankrizsan.se/2016/05/18/enabling-docker-remote-api-on-ubuntu-16-04/
Edit the file /lib/systemd/system/docker.service
Change the line that starts with ExecStart to look like this:
ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:2375
Where my addition is part of "-H tcp: //0.0.0.0: 2375". Save the modified file. Restart the Docker service:
sudo service docker restart
Check if the Docker API is really available:
curl http://localhost:2375/version