How to connect remote Docker service to Plesk Onyx

Created:

2016-11-16 13:21:25 UTC

Modified:

2017-08-08 13:27:29 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to connect remote Docker service to Plesk Onyx

Applicable to:

  • Plesk

Question

How to connect remote Docker service to Plesk Onyx?

Answer

Step 1: Generate SSL certificates

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

This step depends on your OS.

Debian/Ubuntu

Open file /lib/systemd/system/docker.service and change the following line:

ExecStart=/usr/bin/dockerd -H fd://

To:

ExecStart=/usr/bin/dockerd --tlsverify --tlscacert=/etc/docker/ca.pem --tlscert=/etc/docker/server-cert.pem --tlskey=/etc/docker/server-key.pem -H=0.0.0.0:4243 -H=fd://

Note: Change TCP port from 4243 to the desired value.

Then, reload systemd and restart Docker service:

# systemctl daemon-reload
# systemctl restart docker.service

CentOS/RHEL/CloudLinux

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.target

Creating socket is necessary only if you plan to manage the Docker service on the server using docker command, or if the server has Plesk Onyx installed and you want to manage local Docker service from Plesk UI.

Then, open file /lib/systemd/system/docker.service and change the following line:

ExecStart=/usr/bin/dockerd

To:

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.

Note: If you have not enabled socket, remove -H=fd:// from the parameters. *

Then, 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 , and key.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.

Then, 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 , and ca.pem as shown below:

Click OK to add the server:

Have more questions? Submit a request
Please sign in to leave a comment.