System containers or operating containers are the oldest types of containers. It is a standalone OS system solution that doesn’t rely on custom docker images. You can compare system containers to virtual machines. However, unlike virtual machines, system containers have very low overhead and easy management. The fact that system containers allow the reusing of architectures and configurations makes them best suited for traditional or monolithic architectures.
From a developer's perspective, a system container provides a way to containerize specific services that need to run before the docker daemon. These type of containers uses different technologies than the docker-formatted containers. System containers generally rely on ostree for storage, runc for runtime, skopeo for search, and systemd for service management.
As system containers are not docker-formatted, you do not need to use the docker command line for container management. Instead, you use the atomic command line in RedHat or lxc command line in ubuntu and systemd to install, pull and manage system containers.
System containers can be implemented in several ways. However, we are going to look at two of the most popular solution LXD and etcd methods of running system containers.
What is LXD?
LXD is a next-gen system container and VM manager. It offers a seamless user experience in Linux systems that runs inside containers or VMs. When utilizing LXD, you may manage your instances (containers and VMs) by using a straightforward command-line tool, interacting with the REST API directly, or integrating third-party applications. LXD uses a single REST API that can be accessed locally and remotely.
Key features of LXD
- Live migration support and stateful snapshot
- Advanced networking support
- LTS release every two years
- Flexible resource limits (CPU, memory, network, disk space)
How to set up LXD?
- If you are running the latest version of Ubuntu, just install LXD by running
snap install lxd
- Configure lxd by running the command
lxd init
- Install the OS in the container or VM by using the command
Lxc launch <image_server>:<image_name><instance_name>
What is etcd?
Applications that share configuration and service data can use the highly-available key-value store offered by the etcd service. Applications like Kubernetes, Flannel, OpenShift, Fleet, Vulcand, and Locksmith all rely on etcd.
Etcd container is known as a system container. Such type of containers comes either before the docker service or when no docker service is available. Bypassing the docker service is not the only use of etcd container. Besides it, the container is capable of bypassing the docker commands and storage area for holding docker containers.
Features of etcd containers
- Supports atomic pull command line. One can leverage atomic pull to pull the container into your system
- In the event of etcd service initialization, its environmental variables are exported. The variables then identify the location of the data directory, sets the IP address, and port the etcd service listens on.
- After installation of etcd container using atomic command line, one can use systemd systemctl command to manage its services.
How to set up an etcd container?
An etcd container can be set up using 5 simple steps which goes as follows
- Use the RHEL atomic system to run the etcd container running by using the command
# atomic pull --storage=ostree registry.access.redhat.com/rhel7/etcd
- Have a default installation of the etcd container to set up as a systemd service
# atomic install --system rhel7/etcd
Extracting to /var/lib/containers/atomic/etcd.0
systemctl daemon-reload
systemd-tmpfiles --create /etc/tmpfiles.d/etcd.conf
systemctl enable etcd
- Use the systemctl command to initiate the installed etcd container.
# systemctl start etcd
- To ensure that the etcd container is running, you need to use runc list command.
# runc list
ID PID STATUS BUNDLE CREATED
etcd 4521 running /sysroot/ostree/deploy...
- Finally, you would need to make sure that etcd service is up and running. You can do this using the curl command to set a key known as “testkey” and retrieve the key from your etcd container.
# curl -L http://127.0.0.1:2379/v2/keys/testkey -XPUT -d value="testing my etcd"
{"action":"set","node":{"key":"/testkey","value":"testing my etcd","modifiedIndex":6,"createdIndex":6}}
# curl -L http://127.0.0.1:2379/v2/keys/testkey
{"action":"get","node":{"key":"/testkey","value":"testing my etcd","modifiedIndex":6,"createdIndex":6}}
Final thoughts
Containerization technology has advanced and have infiltrated the mainstream IT industry. Enterprises are on the hoard of tweaking and transitioning from traditional methodologies to leverage the benefits of containerization. System containers are one of the elements of the containerization technology that we discussed in brief over here. Let us know in the comments if you have any queries regarding the same.
Top comments (0)