Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to connect remote Docker service to Plesk?
Answer
Note: Managing remote Docker services requires a Plesk license key add-on. Without this add-on, you can only manage the local Docker service, which is running on the Plesk server. Additional details
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.
-
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.
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:CONFIG_TEXT: [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
- Create file
/lib/systemd/system/docker.socket
and put the following configuration inside:
CONFIG_TEXT: [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:CONFIG_TEXT: [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
- Download files
ca.pem
,cert.pem
, andkey.pem
from/etc/docker/
directory.
On a Plesk Onyx server, install Docker Manager extension from Extensions > Extension Catalog:
Note: Managing remote Docker services requires Plesk license key add-on. Without this add-on, Docker Manager extension can only manage local Docker service, that is running on the Plesk Onyx server._
-
Go to Tools & Settings > Docker and click Add Server. Specify the hostname (same hostname that you used on step 1 when generating certificates), port, and
key.pem
,cert.pem
, andca.pem
as shown below:Click OK to add the server:
Comments
0 comments
Please sign in to leave a comment.