When I received my first Raspberry Pi 2, I thought: “maybe I can use it as a web server to host a few of my websites”.

Trying different configurations and security options, I had to start all over a few times… Hours and hours redoing more or less the same things again and again. Now I received a Raspberry Pi 3 and I’d like to transfer my web server on this new device, and I have to redo it completely again? No way…

Docker is a good way to create a development environment that you can then ship as a production environment on another machine without having to redo everything manually.

So if you’re bored of installing and configuring all the time your environments use Docker, and it works on our little Raspberries.

 

Installation procedure

The official documentation is pretty clear and straight  forward, but here are the big lines.

First allow Docker to be installable and upgradable through APT:

$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
$ sudo nano /etc/apt/sources.list.d/docker.list

This docker.list file should only contain this line:

deb https://apt.dockerproject.org/repo raspbian-jessie main

Now we can install Docker and configure the security group:

$ sudo apt-get update
$ sudo apt-get install docker-engine
$ sudo service docker start
$ sudo groupadd docker
$ sudo gpasswd -a ${USER} docker
$ sudo service docker restart

Here you should do a Log off – Log on and then test the installation:

$ docker run armhf/hello-world

Enjoy !  🙂

 

 ______________
< Hello Docker >
 --------------
    \
     \
      \
                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/

PS: I you’re wondering what this is, just follow this tutorial.