Docker is a software technology that provides containers. That’s an extra layer of abstraction and automation of operating-system-level virtualization. As a flexible Plesk tool, Docker can help you perform a wide variety of tasks. Today, I’ll show you how Docker can make your life easier – with examples.
Note: All examples in this article were made using the free version of the Docker extension for Plesk.
Known Issues and Limitations Before deploying a Docker environment, it’s good to know its limitations:
- All ports specified in the Docker file are, by default, exposed. In a cloud environment, you can usually make them available only from the local host using the Cloud firewall and the default Security Group. This can be both an advantage and a drawback.
- Always check whether your containers are accessible from the outside. Make sure to block outside access to the container unless it’s required
- You cannot set read-only permission. All volumes are always mapped with read-write permissions.
- You cannot use the Docker Compose tool and its configuration files.
Deploying and installing Plesk Docker
To deploy the environment and get your hands on this extension you’ll need to:
- Receive a valid SSL/TLS certificate from Let’s Encrypt. (Technically this isn’t necessary, but you know, some people hate self-signed certificate warnings.)
- Click “Extensions” in the menu on the left.
- Search for the Plesk Docker extension.
- Click “Install”. Let it finish.
- Open the extension.
Plesk Docker Extension Use Cases
- On the Plesk forum, customers may ask about upgrading the vendor’s MySQL/MariaDB to the latest version.
- Some of your customers may want to use a web application requiring MySQL 5.7 or MariaDB 10.2. Others may want to use the latest version of the database server because of superior performance.
- A customer may want to have full control – not just over their databases, but over the MySQL server itself.
Web Application Developer
Imagine, you begin developing a new web application. The application will store its data in an SQL-like database. Which SQL-like database should you use? You probably want to write a web application that can work with all popular databases. This will help you get as many customers as possible. So, what databases do you know?
- Officially supported by Plesk (not a full list, only an example)
- MySQL 5.5/5.6/5.7
- MariaDB 10.0/10.1
- PostgreSQL 9.5
- Not supported by Plesk
- MySQL 8.0
- MariaDB 10.2
- PostgreSQL 9.6
- Something else?
- Microsoft SQL Server on Linux
Ok, your web application is done. You want to test it with all these databases. How can you do it? Deploying containers with all necessary databases Let’s take a look at container deployment, step-by-step. We can use the official containers from the Docker Hub:
- MySQL: https://hub.docker.com/_/mysql/
- MariaDB: https://hub.docker.com/_/mariadb/
- PostgreSQL: https://hub.docker.com/_/postgres/
But in this example, we’re going to deploy a container with MariaDB 10.0. Here it is:
- Search for available containers with MariaDB and select the required version.
- Download and wait for it to finish.
- Configure the required settings:
- Switch on auto-start.
- Configure port mapping.
- Add an environment variable with the ‘root’ user password.
- Create a container and wait for it to launch.
- Repeat these steps for MariaDB 10.1/10.2, MySQL 5.5/5.6/5.7/8.0, and PostgreSQL 9.5/9.6.
Add these database servers to Plesk In the shots below, you’ll see the database servers you and your customers can use with Plesk. But first, you’ll need to add them. If a database server is not supported by Plesk, you can connect to the database server directly (MySQL 8.0). Here’s what the output looks like from my console:
And what about Linux? Yup! It’s possible too. We can have MSSQL from Microsoft under Plesk for Linux. Check it out:
You need to install the Memcached daemon to speed up WordPress and decrease CPU utilization. Note: You must disable access to Memcached from anywhere except WordPress, for security reasons. In this example, Plesk is deployed in Google Cloud and is protected by the Cloud Platform Firewall. Memcached
- Check your firewall settings.
- Make sure you’ve blocked all external connections to memcached.
- Search for Memcached container and install.
- Select the ‘auto-start’ checkbox and configure port mapping.
- Start the container. Check that it’s all running fine.
So you’re an organisation that wants to use a self-owned, Nextcloud-based resource for file sharing. Seriously, consider Plesk and Docker. You can do it in just a few clicks.
- Search for and deploy a container with Nextcloud. Wait for it to launch.
- Configure proxy rules for Docker under “Websites & Domains”.
- Open the Nextcloud web interface and set ‘admin’ username and password.
- All done! You can now use Nextcloud.
Developing in GoAlthough Plesk doesn’t have extensions for working with Go, you can still write an application in Go and run it on a Plesk server with Docker. And if you can’t write in Go for some reason, then you can deploy git-service written in Go.
Try out our new Plesk versions
In case you missed it – You can even install Plesk in a Docker container using the Plesk with Docker extension! This way you can try out an early version of Plesk and check out the new features and extensions. But your publicly available websites will still work on a stable version of Plesk.