I
took a relative pause from experimenting with Raspberry Pi to report
my first experiences with something completely different. One of the
first things you realize while programming server-side is how your
program is only one piece of a bigger puzzle. Your application
usually runs inside a container, connects to a database, expose or
consume services and so on ... Solving this puzzle means defining an
installation procedure that becomes different and sometime more
complex by changing or scaling the installation target.
Docker
Docker
is an container platform
that overcomes the installation problems by producing a
ready-to-install standardized operating-system-level
virtual machine, packed with everything your application needs to be
run. Unlike other virtualization solutions a Docker image only
contains what
your application needs without having to
install and run a full hardware simulation
like, for example, in Virtual
Box.
Installation
Docker
is available in two versions a professional “enterprise”
edition and a community one (Docker
CE) free to download. Installing Docker CE on Ubuntu is just
matter of adding Docker repository address
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo apt-key fingerprint 0EBFCD88sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Then
installing it using the usual apt command
sudo apt-get updatesudo apt-get install docker-ce
Once
the installation completed the current user, or any user who will use
Docker, must be added to the “docker” group.
sudo adduser maxx docker
After
logging out and in again Docker was ready for use and command
docker info
Correctly
reported the empty environment initial state
First
run
In
order to test Docker is correctly installed and running a simple
“hello-world” image is available. Just by calling the command:
docker run hello-world
Docker
take care of downloading the image from its repository, installing
and running it.
Another
interesting image to start with is, as suggested in hello-world
printout, the “ubuntu” image that installs and starts a
console-only Ubuntu virtual machine with no effort.