Introduction to Solaris Containers (zones)

Business meeting
Každá IT firma vie, že bez inovácií neprežije
5. februára 2017

Introduction to Solaris Containers (zones)


In this serial, I will try to help you to get to know Solaris Containers (zones) better. It is aimed at beginners, who have just started to use them.

When I ssh-ed into a zone for the first time, it felt alright. As a long time Linux user, I had to adjust to some differences. Although there is plenty of documentation for advanced users, I really miss introductory articles. At Danube Cloud, we use SmartOS based zones. Let me do a brief Solaris introduction with a comparison to Linux. I hope this serial will help you to use them on a daily basis with ease and comfort.

What are Solaris Containers?

Solaris Containers (including Solaris Zones), is a virtualization technology. Solaris containers are on the market from 2004, and they are considered mature and stable technology. If you are an illumos (formerly OpenSolaris), OpenIndiana, SmartOS or Danube Cloud user, you might have already used them.

A Solaris Container is the combination of system resource controls and the boundary separation provided by zones. Zones act as completely isolated virtual servers within a single operating system instance. By consolidating multiple sets of application services onto one system and by placing each into isolated virtual server containers, system administrators can reduce cost and provide most of the same protections of separate machines on a single machine. [1]

How does a container differ from a virtual machine?

Container virtualization is a lightweight environment that groups and isolates a set of processes and resources such as CPU, memory, disk, etc. The main difference between a container and a virtual machine is that all containers share the same kernel of the host system. There is no overhead of the whole operating system as it is the case in the virtual machine. The isolation guarantees that processes inside the container cannot see processes or resources outside the container.

Containers are considered more resource-efficient than virtual machines because the additional resources needed for an operating system in a virtual machine are eliminated. Container instances are smaller and faster to create or migrate.

A downside of containers is that they have to run the same operating system as the host machine, unlike virtual machines, which can run any operating system supported by the hypervisor. Another potential issue is the security of the container. As the container shares kernel of the host system, it might lead to security threats that may compromise the whole host operating system.

For the purpose of this introductory serial, you can think of OS containers as virtual machines.

Do I use a zone differently than a Linux server?

Since it is a *nix system, basic commands are the same. If you like to look around on the file system, move files, create directories, etc., you’ll do it the same way as you are used to in a Linux terminal. There is a huge set of applications available for zones, most of them also available in Linux. The first difference you may notice is how you install them. The package manager is called pkgsrc (package source). It is also available in Linux, but I don’t think any major distribution use it as a default one. Most likely this will be new for you. Don’t worry, it is straightforward to use, and if you are used to any other package manager, you won’t have any problem. Most of the time it is just about the terminology. Different package managers use different parameter names. Here are few basic commands and a comparison with yum, apt-get and dnf.

Upgrade all of your system software to the latest version:

RHEL/CentOS Fedora Debian/Ubuntu Zone
yum update dnf update apt-get update
apt-get upgrade
pkgin update
pkgin full-upgrade

View all available packages:

RHEL/CentOS Fedora Debian/Ubuntu Zone
yum list dnf list apt-cache search . pkgin avail

Install package to your system:

RHEL/CentOS Fedora Debian/Ubuntu Zone
yum install package dnf install package apt-get install package pkgin install package

I suggest browsing the pkgin website:, where you can find common usage examples.

Where does pkgsrc store files?

The utility installs files in several directories within /opt/local.

Directory Description
/opt/local Files installed by pkgsrc.
/opt/local/etc Directory containing the configuration files.
/opt/local/share/examples Directory with example configuration files.
/var/db/pkg Directory where database of installed and available packages is stored.
You can damage pkgsrc by amending the content of this directory.

When you update, remove, or reinstall a package, you will not lose any custom configuration. This is because pkgsrc copies configuration files into /opt/local/etc only if they do not already exist.

Finally, we know how to install applications. In the next part of this zones introduction serial, we will talk about services and how to manage them.



Richard Kellner
Richard Kellner
Python developer and system administrator at Danube Cloud.

Pridaj komentár

Vaša e-mailová adresa nebude zverejnená. Vyžadované polia sú označené *