Container management with Docker
Easier Control with Panamax
Even though Docker's command structure is quite simple and is based largely on Git, it quickly gets unwieldy with many containers. Panamax [19], the first graphical interface for managing Docker containers (still in beta), solves this problem (Figure 6).
To install the browser-based GUI, you first need to install Vagrant version 1.6.5 or higher and VirtualBox 1.4.2 or higher (Figures 7 and 8). If the versions aren't available to you, you'll need to get the Vagrant [20] and VirtualBox [21] packages in Debian format off their websites. Panamax can currently be installed only on Debian-based distributions or the Apple Mac OS. It's really only a question of time that stable versions of other package formats are supported.
Once the prerequisites are met, enter the command
$ curl http://download.panamax.io/installer/ubuntu.sh | bash
to install the minimum CoreOS container operating system and Panamax in VirtualBox (Figure 9). The process runs automatically and finishes by having you enter the http://localhost:8888
URL in your browser, which opens the Panamax interface. There you can search for images, install, run, modify, manage, and save (Figures 10 and 11). To make the best use of Panamax at this stage requires internalizing the Docker principle. Particularly important is distinguishing between an image and a container. With the help of Panamax and its documentation, you can get containers up and running quickly without entering any by hand (Figure 12). If an error occurs, you simply delete the image and start over.
Conclusion
The container principle is far from new. FreeBSD jails [22], Solaris Zones [23], OpenVZ [24], and LXC have existed for quite some time. Even the good old Linux chroot
is nothing else in principle than a container. However, it looks like the makers of Docker bundled the right ideas into free software at the right time. (See the "Basic Commands" box for more information.)
Basic Commands
You can install Docker with the following command:
$ sudo apt-get update && apt-get install docker.io
Serious work with Docker also involves installing the following packages:
$ sudo apt-get install cgroup-tools dbootstrap rinse \ cgroupfs-mount aufs-tools
To run commands without root privileges, do:
$ sudo gpasswd -a <username> docker
To open an account, go to the Docker sign-up page [26], then register as a user:
$ docker login
Search for the desired image (e.g., Debian):
$ docker search debian
Currently, 360 different Debian images reside in the Docker hub, requiring you to select carefully the one that fits your needs. Each image is described in detail. For the test, the first image with the name debian
should be enough:
$ docker pull debian
The image is then downloaded onto the local machine. Next, start the image in a container in the shell:
$ docker run -t -i debian /bin/bash
You can also simply load an image directly with docker run
without using docker pull
. The image will be fetched if it isn't available locally. Next, you'll see a prompt that shows something like:
user@70a1d73753b5:
The number after the name is the container ID. Entering
$ user@70a1d73753b5: cat /etc/debian_version
should return 7.6
as the Debian version. The command
$ docker run -d ...
moves a container in the background. Entering
$ docker ps
shows the running containers, and
$ docker ps -a
shows all containers. Use exit
or Ctrl+D to exit from the container; then, remove the previously stopped container with
$ docker rm debian
and the image with:
$ docker rmi debian
Many more options are described in the Docker user guide [27].
Three operating systems have emerged around Docker – CoreOS, Red Hat's Atomic project, and Dockerera – using the container technology for clusters and other expanded applications. Although it seems like conventional virtualization such as VirtualBox and VMware can't keep up with the speed and lower consumption of Docker containers, VMs aren't likely to go away any time soon. Thus, for security reasons at Google, Docker containers run on virtual machines. Hundreds of containers can be distributed among a few VMs with twice the security.
Docker in VMs can also run under different platforms, as the Boot2docker project [25] has shown (Figure 13). The operating system ISO image at only 23MB is based on Tiny Core Linux and can be run in VirtualBox as well as Mac OS and Windows. It was designed to use Docker containers in OSs other than Linux. Boot2docker is ideal for a first Docker test.
What's Ahead
Whether Docker will become more accessible to end users is yet to be seen. No doubt containers make sense deployed on the desktop as well. You can use Docker to isolate less trusted programs or processes from the rest of the operating system. Tests with slightly altered conditions can be run in containers and compared with diff
.
If you're occasionally building packages for your own use, you can depend on Docker as a build environment instead of chroot
. Also, users can build operating systems tailored to their needs from a base image, save them as a Docker image, and then publish them on the Docker hub. If you want to test Docker without much effort, consider Boot2docker.
Infos
- Docker: https://docs.docker.com/
- Kubernetes: http://www.datacenterknowledge.com/archives/2014/07/10/googles-docker-container-management-project-kubernetes-gets-big-league-support/
- Hypervisor: http://en.wikipedia.org/wiki/Hypervisor
- Cgroups: http://www.linux-magazine.com/Issues/2011/130/Security-Lessons-cgroups-and-LXC/%28language%29/eng-US
- Namespaces: http://lwn.net/Articles/531114/
- LXC: http://en.wikipedia.org/wiki/LXC
- PaaS: http://en.wikipedia.org/wiki/Platform_as_a_service
- CVS: http://en.wikipedia.org/wiki/Concurrent_Versions_System
- SaaS: http://en.wikipedia.org/wiki/Software_as_a_service
- aufs: http://en.wikipedia.org/wiki/Aufs
- Device mapper: http://en.wikipedia.org/wiki/Device_mapper
- Btrfs: http://en.wikipedia.org/wiki/Btrfs
- Filesystems: http://www.projectatomic.io/docs/filesystems/
- Project Atomic: http://www.projectatomic.io/
- Base image: https://docs.docker.com/terms/image/#base-image-def
- Git: http://en.wikipedia.org/wiki/Git_(software)
- Dockerfile: https://registry.hub.docker.com/u/toke/owncloud7/dockerfile/
- Docker 1.2: http://blog.docker.com/2014/08/announcing-docker-1-2-0/
- Panamax: http://panamax.io/
- Vagrant: https://www.vagrantup.com/downloads.html
- VirtualBox: https://www.virtualbox.org/wiki/Downloads
- FreeBSD jail: http://en.wikipedia.org/wiki/FreeBSD_jail
- Solaris Zones: http://en.wikipedia.org/wiki/Solaris_Containers
- OpenVZ: http://en.wikipedia.org/wiki/OpenVZ
- Boot2docker: http://boot2docker.io/
- Sign up for Docker: https://hub.docker.com/account/signup/
- Docker user guide: http://docs.docker.com/userguide/
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.