PouchContainer is an open-source container technology by Alibaba. Just like Docker, PouchContainer utilizes the image technology. A 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.
PouchContainer has the following features:
PouchContainer includes a rich container
mode: This is having features and functions of a container that can be extended to support a broader range of requirements such as health status monitoring, threads, stack, lock contention, network message statistics and configuration information.
Isolation: The technology embraces high isolation and security principles, like hypervisor-based container technology, lxcfs, directory disk quota, patched Linux kernel etc.
On a large scale deployment, pouch container utilizes Dragonfly, a P2P-base distribution system that increases the rate of container distribution with a huge margin.
PouchContainer is Kubernetes compatible such that you can easily migrate from one Kubernetes runtime to PouchContainer.
Pouch container has many advantages over traditional VM technologies. Let us explore some of the interesting ones:
1. Resource friendly
Applications running on PouchContainer can minimize their storage usage with a layered image structure. It also allows incremental image distribution which in turn saves bandwidth consumption compared to legacy VM technologies.
2. Application oriented
PouchContainer provides cross-platform and cross-OS application delivery. This is made possible with the strong application runtime isolation technique.
Install Pouch Container on Ubuntu 22.04|20.04|18.04
PouchContainer works hand-in-hand with LXCFS for isolation. LXCFS is a user-space filesystem used in the implementation of containers.
We need to install LXCFS beforehand, in order to have PouchContainer running on our Ubuntu server:
sudo apt update
sudo apt install lxcfs
Install packages that will allow aptitude to use a repository over HTTPS:
sudo apt install curl apt-transport-https ca-certificates software-properties-common
The next step is to add PouchContainer’s official GPG key:
curl -fsSL http://mirrors.aliyun.com/opsx/pouch/linux/debian/[email protected] | sudo apt-key add -
Add PouchContainer repository to your Ubuntu server:
sudo add-apt-repository "deb http://mirrors.aliyun.com/opsx/pouch/linux/debian/ pouch stable"
Install the latest version of PouchContainer:
sudo apt update
sudo apt install pouch
Start and enable PouchContainer
sudo systemctl start pouch
sudo systemctl enable pouch
We now have Pouch Container deployed successfully on Ubuntu server. We’ll be exploring some of the basic PouchContainer commands later in this article.
How To Install PouchContainer on CentOS 7
Note that PouchContainer can’t be installed alongside Docker on the same instance. If you have a running Docker service and wish to install PouchContainer, uninstall Docker before installing PouchContainer.
The steps below will guide you on how to install PouchContainer on an instance running CentOS 7
1. Install yum utilities
sudo yum install -y yum-utils
2. Configure PouchContainer repositories to your Centos 7 server and update the system:
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/opsx/opsx-centos7.repo
sudo yum update
3. Install PouchContainer
sudo yum install pouch
PouchContainer creates a group ‘pouch’ with no users added to it. Only root user has exclusive access to any user-group.
4. Start PouchContainer
sudo systemctl start pouch
sudo systemctl enable pouch
To run pouch commands with non-root users we need to add the user to the pouch group:
Add user to group
sudo gpasswd -a $USER pouch
PouchContainer Container Engine Usage
PouchContainer has an architecture of client/server. In this case, there are two command-line that are issued depending with the context:
pouchd: a daemon side binary to run as a server;
pouch: a client side binary to run as a client.
Deploying a simple Nginx application on PouchContainer
As mentioned earlier, it is compatible with docker images.
We’ll download nginx image and run an nginx container:
pouch run --name webserver -p 80:80 -d nginx
This command downloads nginx image from docker repository and starts the container named ‘webserver’.
The container has an internal port 80 mapped to port 80 of the server.
To verify if the container is running:
pouch ps -a
The output should be as follows:
[root@pouch ~]# pouch ps -a
Name ID Status Created Image Runtime
webserver ad50b8 created 13 seconds ago registry.hub.docker.com/library/nginx:latest runc
Nginx can now be accessible on port 80 of the host:
To run native commands on a container use pouch exec:
$ pouch exec -it <container> [command]
# Example
$ pouch exec -it webserver /bin/bash
PouchContainer basic management commands
Other PouchContainer basic usage commands include:
$ pouch version
Version: 1.3.0
APIVersion: 1.24
Arch: amd64
BuildTime: 2019-06-13T11:25:25+00:00
GitCommit: 1.3.0
GoVersion: go1.10.4
KernelVersion: 3.10.0-1127.el7.x86_64
Os: linux
1. Pouch pull
Usage: pouch pull <image>
[root@pouch ~]# pouch pull ubuntu
registry.hub.docker.com/library/ubuntu:latest: resolved |++++++++++++++++++++++++++++++++++++++|
index-sha256:bc2f7250f69267c9c6b66d7b6a81a54d3878bb85f1ebb5f951c896d13e6ba537: done |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:2e70e9c81838224b5311970dbf7ed16802fbfe19e7a70b3cbfa3d7522aa285b4: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:b6a83d81d1f4f942d37e1f17195d9c519969ed3040fc3e444740b884e44dec33: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:d72e567cc804d0b637182ba23f8b9ffe101e753a39bf52cd4db6b89eb089f13b: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:0f3630e5ff08d73b6ec0e22736a5c8d2d666e7b568c16f6a4ffadf8c21b9b1ad: done |++++++++++++++++++++++++++++++++++++++|
config-sha256:9140108b62dc87d9b278bb0d4fd6a3e44c2959646eb966b86531306faa81b09b: done |++++++++++++++++++++++++++++++++++++++|
elapsed: 12.3s total: 27.2 M (2.2 MiB/s)
2. pouch run
Usage: pouch run -it <image>
This command is used to create a container from an image
[root@pouch ~]# pouch run -it ubuntu
root@f4abc5c8966b:/#
Show list pf locally stored pouch images
pouch images
3. Stop pouch container:
Stop the container first using syntax:
pouch stop <container>
# Example
pouch stop webserver
4. Remove container
To remove a container use the command syntax:
pouch rm <container>
e.g
pouch rm webserver
5. pouch commit
Usage:
docker commit <conatainer id> <username/imagename>
This command creates a new image of an edited container on the local system
Pouch Daemon Config
With daemon config file, a user can set flags to for pouchd: a server side commandline tool.
With PouchContainer, there are two ways for users to pass flags to daemon:
- Running pouchd directly with flags specified, e.g
pouchd -c /var/run/containerd.sock
, - Using daemon config file.
Pouchd flags can be found at https://github.com/alibaba/pouch/blob/master/docs/commandline/pouchd.md
Configuring pouchd config file:
Users are recommended to set daemon flag through daemon config file, the default path to config file is /etc/pouch/config.json
, you can change it by set value of --config-file
Runtime format
If user want to add more runtime into pouchd, add like:
{
"add-runtime": {
"runc": {
"path": "/usr/local/bin/runc",
"runtimeArgs": [
"--debug"
]
}
}
}
Steps to configure config file
- Install PouchContainer
- Edit daemon config file, like:
{
"image-proxy": "http://127.0.0.1:65001",
"debug": false
}
3. Start pouch service:
systemctl start pouch
How To Uninstall pouch
On Ubuntu:
sudo apt-get purge pouch
On CentOS
sudo yum remove pouch
After running the remove command, images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers and volumes, execute the following command:
sudo rm -rf /var/lib/pouch
Conclusion
PouchContainer is one of the best container technologies. It has many advantages over the legacy VM technology and has many features that you would really want to explore. We’ll be covering more features of PouchContainer in other articles on this site. Feel free to leave a message if you have any suggestions about the technology, or if you encounter any issues during the installation process.