Question
How to connect remote Docker service to Plesk?
Answer
To start using Docker that runs on a remote host:
- Login to Plesk
- Go to Tools & Settings > Docker (under Server Management).
- Click Add Server and specify the settings of the remote server with Docker.
- To start using this Docker service in Plesk, leave Set active selected.
The link to Docker will appear in the left navigation panel.
To switch between Docker services:
- Go to Tools & Settings > Docker (under Server Management).
- In the list of servers, select the server that you are going to use and click Set Active.
Alternatively, you can set the server as active while editing its settings.
On a server with running Docker service, generate SSL certificates using instructions from the Docker documentation.
Important: Use correct and resolvable server hostname and IP addresses when creating certificates.
Save certificate files in /etc/docker/
directory.
Step 2: Configure Docker service to listen on a TCP port
Note: This step depends on your OS
Debian/Ubuntu
- Execute the following command:Â
# systemctl edit docker.service
This will create the necessary directory structure under
/etc/systemd/system/docker.service.d
and open an editor (using the default editor configured for the user) to the override file. Add the section below into the editor:[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --tlsverify --tlscacert=/etc/docker/ca.pem --tlscert=/etc/docker/server-cert.pem --tlskey=/etc/docker/server-key.pem -H=tcp://0.0.0.0:4243 -H=fd://Note: Change TCP port from 4243 to the desired value. The port should not be blocked by a server firewall.
-
Reload systemd and restart Docker service:
# systemctl daemon-reload
# systemctl restart docker.service
CentOS/RHEL
- Create file
/lib/systemd/system/docker.socket
and put the following configuration inside:[Unit]
Description=Docker Socket for the API
PartOf=docker.service
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.targetCreating socket is necessary only if you plan to manage the Docker service on the server using docker command.
- Execute the following command:Â
# systemctl edit docker.service
This will create the necessary directory structure under
/etc/systemd/system/docker.service.d
and open an editor (using the default editor configured for the user) to the override file. Add the section below into the editor:[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --tlsverify --tlscacert=/etc/docker/ca.pem --tlscert=/etc/docker/server-cert.pem --tlskey=/etc/docker/server-key.pem -H=tcp://0.0.0.0:4243 -H=fd://Note: Change TCP port from 4243 to the desired value. The port should not be blocked by a server firewall.
Note: If you have not enabled socket, remove
-H=fd://
from the parameters. -
Reload systemd, enable and start the socket, and restart Docker service:
# systemctl daemon-reload
# systemctl enable docker.socket
# systemctl start docker.socket
# systemctl restart docker.service
Step 3: Connect remote Docker service to Plesk Onyx
- Download files
ca.pem
,cert.pem
, andkey.pem
from/etc/docker/
directory.On a Plesk Onyx server, install Docker Manager extension from…