CyberPanel is an alternative for cPanel, one that allows you to deploy and host websites for clients with speed and ease. But CyberPanel does have a few extra tricks up its sleeve; one such trick will be most welcome to those developers looking to add containers into their offerings.
I’m talking about Docker. CyberPanel allows admins to pull images and create/deploy containers from those images, all from the convenience of a well-designed web interface. I’ve already walked you through the steps of getting CyberPanel up and running (read: CyberPanel makes one-click installing of web-hosted apps and services simple). In this how-to, I’m going to show you how to add Docker support into the mix and then deploy a simple container.
SEE: Kubernetes: A cheat sheet (free PDF) (TechRepublic)
What you’ll need
There are only two things you’ll need to make this happen:
- A running instance of CyberPanel
- A user with sudo privileges
Let’s make some container magic.
How to install Docker
For CyberPanel to work with Docker containers, Docker must first be installed. Since we installed CyperPanel on Ubuntu Server 20.04, this is quite simple. Log into your hosting server and issue the following command to install Docker:
sudo apt-get install docker.io -y
Once that completes, you should add your user to the docker group. Even though CyberPanel does not use your user for this, you should do so (in case you need to work with Docker from the command line). This is handled with the command:
sudo usermod -aG docker $USER
Log out and log in for the changes to take effect.
How to deploy a container with CyberPanel
We can now work with containers in CyberPanel. Log into your instance and click Docker Manager in the left navigation (Figure A).
After the menu expands (Figure B), select Manage Images.
Since we’ve yet to pull down any images, let’s do so. We’ll pull down the latest version of the NGINX container. In the search field, type nginx, and then, when the results appear, click the Tag drop-down and locate the NGINX tag you’re looking for and then click Pull.
With the NGINX container pulled, go back to the Docker Manager menu and click Create New Container. In the resulting window (Figure D), you should see our NGINX image. Select the tag for the image (in this instance, there’ll only be one, and click Create.
We can now fill out the details for our container. Make sure to configure everything necessary for the container and then click Create Container. If you need to map a volume for the container, click Add filed under Map Volumes and then enter the local directory under source and the container directory under destination (Figure E).
Once the container has been created, you can then run it by clicking the Start button in the container management window (Figure F).
You should then see the container listed as Running. Congratulations, you’ve just deployed your first container with CyberPanel. You can now add containers to the list of features you offer as a hosting provider.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.