Articles in this section

How to use remote Docker service to Plesk?

Plesk for Windows kb: how-to Plesk for Linux ABT: Group A

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:

  1. Login to Plesk
  2. Go to Tools & Settings > Docker (under Server Management).
  3. Click Add Server and specify the settings of the remote server with Docker.
  4. 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 (server):
  1. Go to Tools & Settings > Docker (under Server Management).

  2. In the list of servers, select the server that you are going to use and click Set Active:

    mceclip0.png

Alternatively, you can set the server as active while editing its settings.

Internal. Old instructions used long time ago: 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

Note: This step depends on your OS

Debian/Ubuntu
  1. 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.

  2. Reload systemd and restart Docker service:

    # systemctl daemon-reload

    # systemctl restart docker.service

CentOS/RHEL
  1. 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.target

    Creating socket is necessary only if you plan to manage the Docker service on the server using docker command.

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

  3. 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
  1. 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._

  2. 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:

     

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.