fbpx

Docker binds to Unix socket by default, normally the socket is owned by root user. When CyberPanel tries to access Docker API it receive permission issue. This happens in 2 case

  1. Either you have installed Docker Manually (via yum or apt packages)
  2. Or during installation user/group did not set up properly.

To fix the issue, we can manually create docker group and add cyberpanel user to this group, use commands below to get around this issue

groupadd docker
usermod -aG docker cyberpanel
systemctl enable docker
reboot

 

Before reading this tutorial you must read:

  1. Getting Started with CyberPanel Docker Manager.
  2. Search/Pull/Download and Manage Docker Images.
  3. Create Docker Container.

By the time you read this document, I assume that you have at least one container already created and running.


Manage Containers

On CyberPanel Dashboard click Manage Containers under Docker Manager.

 

This will open the containers page. Where you can launch containers and manage them.

 

 

Once launched, rest is self-explanatory. You can:

  1. Start/Stop Containers.
  2. View CPU/Memory Usage.
  3. View Port Mappings.
  4. View processes inside the container.
  5. View Container logs.

 

Before reading this tutorial you must read:

  1. Getting Started with CyberPanel Docker Manager.
  2. Search/Pull/Download and Manage Docker Images.

After installing Docker and pulling your images, you are now ready to create your Docker Container. Docker containers are just running instances of Docker Images. In Dockers own words:

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

 


Create New Container

Let see how we can create our Docker Container.

 

In CyberPanel Dashboard click Create New Container under Docker Manager in left sidebar.

You will be presented with list of locally available images (along with their tags) that you can use to create a Docker Container. We are going to use usmannasir/openlitespeed-1.4.42 image and its stable tag to create a new container. Its a simple image with OpenLiteSpeed installed in it. Once your image/tag is selected click Create.

 

The image we choose above exposes port 7080 and 8088 you can map them to your host ports (we choose 8081 and 8082). Make sure that ports you choose are not used by any other process. Finally click Create Container. If creation went successful you will be redirected to the container page where you can manage different aspects of container (we will discuss that in our new document).

By default container is in created state, you can click start to change its state to running.

 

 

Once running visit: http://<ServerIP:8082 and you should see OpenLiteSpeed Welcome page.

 

Before reading this tutorial you must read:

  1. Getting Started with CyberPanel Docker Manager.

Once Docker is installed, you are ready to search and find images.


Manage Images

 

Once logged into CyberPanel, click Manage Images as highlighted in the image above. It will open the Manage Images window, where you can Search, Pull and Delete images.

Locally Available Images

Once you land on this page, you will see locally available images if any. (Previously pulled)

As you can see image usmannasir/openlitespeed-1.4.42:stable is already locally available on this server. You can Delete or view Image History by clicking the buttons under Action.

Search and Pull Images

On the same page you can also search for images available on Docker Hub (only public images will be shown in the search results).

 

Put name of your image in the search bar so that related images can be fetched. From drop down you can select the tag and pull the image. Once pulled, this image will be listed as locally available.

Manually Pull Images

You can also download images manually via command line and they will be detected and listed as locally available image on Manage Images page. For example you have a private Docker repository, and you want to fetch an image from this repo.

You can login using docker login command on cli and pull the image using docker pull. Both public and private images can be pulled like that.

docker pull usmannasir/openlitespeed-1.4.42:stable

By the end of this tutorial, you already have your desired images locally available, you are now ready to create your first container out of it. 🙂

CyberPanel v1.7.8 and above gives you ability to view and manage Docker container/images.  (Make sure you are on version 1.7.8 or above, you can visit upgrade instructions)

What is Docker?

Docker use containerization technology to make it easy to deploy and run applications. As a developers we use to hear that It works on my computer/environment but it wont work when you deploy the application to production environment. Docker solves this issue by packaging the application code along with all the libraries and dependencies it needs to run. Once you package your application it will run in any environment where docker is available.

CyberPanel gives you the ability to manage your docker container and images the easy way. Some of the exciting features of CyberPanel Docker Manager:

  1. Search and pull images from Docker Hub (Along with tags).
  2. Prune the system.
  3. Create Container from available/pulled images.
  4. List and manage container that includes:
    1. Start/Stop Containers.
    2. View Logs.
    3. Export the file.
    4. View Processes inside the container.
    5. Delete Containers.
    6. Re-create containers.

Docker Installation

Docker is not installed by default (during CyberPanel installation). So when you visit any docker related pages CyberPanel will prompt you to install Docker.

 

 

Under Docker Manager you can click any link such as Manage Images, and it will redirect you to installation page (only if Docker is not already installed)

 

Click Install Now to start the installation process, it will take from few seconds to few minutes. Once installation is completed page will auto-refresh. We are now ready to manage docker images and containers.

Next: 2 - Search/Pull/Download and Manage Docker Images

Warning: This feature is discontinued, visit How to Create High Availability Cluster in CyberPanel Cloud?

We will now set up highly available application on our cluster we just created in previous setup, if you've not created a cluster make sure to read Setting up Highly Available Cluster from Cloud Platform.


Step 1: Create Application

Manager Node IP: 192.168.1.1

Worker Node IP: 192.168.1.2

Domain: ha.cyberpanel.net

You need to make sure that DNS record of your domain is pointing to 192.168.1.1 (which is the IP of your Manager Node)

Once done, navigate to: https://platform.cyberpanel.net/ha/manage/<Cluster Name>/launchApplication

Replace Cluster Name with the name of your cluster.

 

Enter your domain and click Launch Application. Now you can open your browser and visit http://yourdomain.com:4000/

Here 4000 is the port we choose to expose, you can replace it with the port that you choose to expose. If you choose port 80, make sure its free and not occupied by any other process.

Data of this application resides on your Worker Node, you can login to CyberPanel on worker node and setup any application such as WordPress. (Your normal database will not work with such application as they are running from containers, you can create cloud database on amazon or setup remote access to your database)

Warning: This feature is discontinued, visit How to Create High Availability Cluster in CyberPanel Cloud?

CyberPanel Cloud Platform let you set up highly available applications. On the back end Docker containers are used. Before moving forward you need at least 2 CyberPanel instances to create a cluster, later you can add more instances as well. You can use UpCloud for free to set up your environment.

Note: Both of your instances must have Ubuntu 18.04 as operating system.


Step 1: Connect Servers to Platform !

If you are not already registered, you will first need to register your self on platform. Once registered you can connect two instances from here.


Step 2: Create Cluster !

Once you have connected two CyberPanel instances to platform you can navigate to Create Cluster. There you will see something like:

 

 

Once all of these settings are configured you can click Create Cluster (It will take some time to complete the setup)

Please note that Data Node will be used to store persistent data for your application, all other nodes just provide compute resources to your cluster, so make sure all these nodes reside on same location. Once setup is completed, navigate to Manage Clusters and make sure your cluster appears there.

Next: Setting up Highly Available Application

 

 

chevron-down