Installing docker on ubuntu

Installing docker on an ubuntu 16.04 Virtual Machine

Bibliography

Docker documentation: https://docs.docker.com/engine/installation/linux/ubuntulinux/

Let’s go

I basically followed the documentation available in the bibliography. Here are the commands I entered and the results:

Prerequisites

Reference

https://docs.docker.com/engine/installation/linux/ubuntulinux/#/prerequisites

Input

uname -r

Output

4.4.0-36-generic

Analysis

My kernel it’s 4.4.x, that’s fine.

Input

sudo apt-get update

Output

Trovato:1 http://it.archive.ubuntu.com/ubuntu xenial InRelease
Scaricamento di:2 http://it.archive.ubuntu.com/ubuntu xenial-updates InRelease [95,7 kB]
Scaricamento di:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [94,5 kB]
...
Recuperati 1.285 kB in 12s (103 kB/s)
Lettura elenco dei pacchetti... Fatto

Analysis

My APT index it’s updated.

Input

sudo apt-get install apt-transport-https ca-certificates

Output

Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
ca-certificates is already the newest version (20160104ubuntu1).
apt-transport-https is already the newest version (1.2.12~ubuntu16.04.1).
0 aggiornati, 0 installati, 0 da rimuovere e 3 non aggiornati.

Analysis

The apt-transport-https and ca-certificates packages were already installed.

Input

sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Output

Executing: /tmp/tmp.R97nJLsyWy/gpg.1.sh --keyserver
hkp://p80.pool.sks-keyservers.net:80
--recv-keys
58118E89F3A912897C070ADBF76221572C52609D
gpg: richiesta della chiave 2C52609D dal server hkp p80.pool.sks-keyservers.net
gpg: chiave 2C52609D: chiave pubblica "Docker Release Tool (releasedocker) <docker@docker.com>" importata
gpg: Numero totale esaminato: 1
gpg:               importate: 1  (RSA: 1)

Analysis

It looks good, the key it’s from them.

Input

sudo nano /etc/apt/sources.list.d/docker.list

Delete everything (if present) and paste just this line:

deb https://apt.dockerproject.org/repo ubuntu-xenial main

Exit and save.

Analysis

We added the docker repos the the APT list.

Input

sudo apt-get update

Output

Scaricamento di:1 https://apt.dockerproject.org/repo ubuntu-xenial InRelease [30,2 kB]
Scaricamento di:2 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages [2.313 B]
Scaricamento di:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [94,5 kB]
Trovato:4 http://it.archive.ubuntu.com/ubuntu xenial InRelease
Trovato:5 http://it.archive.ubuntu.com/ubuntu xenial-updates InRelease
Trovato:6 http://it.archive.ubuntu.com/ubuntu xenial-backports InRelease
Recuperati 127 kB in 10s (12,0 kB/s)
Lettura elenco dei pacchetti... Fatto

Analysis

The APT index it’s update also from the the new repos added.

Input

sudo apt-get purge lxc-docker

Output

Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
Il pacchetto "lxc-docker" non è installato e quindi non è stato rimosso
0 aggiornati, 0 installati, 0 da rimuovere e 3 non aggiornati.

Analysis

There was no need to purge the packet because it wasn’t already installed.

Input

apt-cache policy docker-engine

Output

docker-engine:
  Installato: (nessuno)
  Candidato:  1.12.1-0~xenial
  Tabella versione:
     1.12.1-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
     1.12.0-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
     1.11.2-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
     1.11.1-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
     1.11.0-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages

Analysis

It’s getting it from the xenial repo so it’s fine for ubuntu 16.04

Installing

Reference

https://docs.docker.com/engine/installation/linux/ubuntulinux/#/install

Input

sudo apt-get update

Output

Trovato:1 https://apt.dockerproject.org/repo ubuntu-xenial InRelease
Scaricamento di:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94,5 kB]
Trovato:3 http://it.archive.ubuntu.com/ubuntu xenial InRelease
Trovato:4 http://it.archive.ubuntu.com/ubuntu xenial-updates InRelease
Trovato:5 http://it.archive.ubuntu.com/ubuntu xenial-backports InRelease
Recuperati 94,5 kB in 10s (8.912 B/s)
Lettura elenco dei pacchetti... Fatto

Analysis

The APT index it’s updated again.

Input

sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

Output

Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
linux-image-extra-4.4.0-36-generic is already the newest version (4.4.0-36.55).
È stato impostato linux-image-extra-4.4.0-36-generic per l'installazione manuale.
The following additional packages will be installed:
  linux-generic linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic
  linux-headers-generic linux-image-4.4.0-38-generic
  linux-image-extra-4.4.0-38-generic linux-image-generic
Pacchetti suggeriti:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
Pacchetti raccomandati:
  thermald
I seguenti pacchetti NUOVI saranno installati:
  linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic
  linux-image-4.4.0-38-generic linux-image-extra-4.4.0-38-generic
  linux-image-extra-virtual
I seguenti pacchetti saranno aggiornati:
  linux-generic linux-headers-generic linux-image-generic
3 aggiornati, 5 installati, 0 da rimuovere e 0 non aggiornati.
È necessario scaricare 68,5 MB di archivi.
Dopo quest'operazione, verranno occupati 296 MB di spazio su disco.
Continuare? [S/n] s
Scaricamento di:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-image-4.4.0-38-generic amd64 4.4.0-38.57 [18,7 MB]
...
Configurazione di linux-image-generic (4.4.0.38.40)...
Configurazione di linux-headers-4.4.0-38 (4.4.0-38.57)...
Configurazione di linux-headers-4.4.0-38-generic (4.4.0-38.57)...
Configurazione di linux-headers-generic (4.4.0.38.40)...
Configurazione di linux-generic (4.4.0.38.40)...
Configurazione di linux-image-extra-virtual (4.4.0.38.40)...

Analysis

linux-image-extra-4.4.0-38-generic and linux-image-extra-virtual are now installed with all their dependencies.

Input

sudo apt-get update

Output

Basically it’s always the same…

Analysis

Updated the APT index again…

Input

sudo apt-get install docker-engine

Output

Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
The following additional packages will be installed:
  aufs-tools cgroupfs-mount git git-man liberror-perl libltdl7 patch xz-utils
Pacchetti suggeriti:
  mountall git-daemon-run | git-daemon-sysvinit git-doc git-el git-email
  git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn diffutils-doc
I seguenti pacchetti NUOVI saranno installati:
  aufs-tools cgroupfs-mount docker-engine git git-man liberror-perl libltdl7
  patch xz-utils
0 aggiornati, 9 installati, 0 da rimuovere e 0 non aggiornati.
È necessario scaricare 23,5 MB di archivi.
Dopo quest'operazione, verranno occupati 128 MB di spazio su disco.
Continuare? [S/n] s
Scaricamento di:1 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 docker-engine amd64 1.12.1-0~xenial [19,5 MB]
…
Elaborazione dei trigger per libc-bin (2.23-0ubuntu3)...
Elaborazione dei trigger per systemd (229-4ubuntu8)...
Elaborazione dei trigger per ureadahead (0.100.0-19)...

Analysis

Docker engine it’s now installed!

Input

sudo service docker start

Output

Nothing

Analysis

The docker service is started.

Input

sudo docker run hello-world

Output

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Analysis

It works! The hello world image was run successfully!

Adding a docker group

Reference

https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-group

Input

sudo groupadd docker

Output

groupadd: group 'docker' already exists

Analysis

I don’t need to add a docker unix group because it was created during the install.

Input

sudo usermod -aG docker $USER

Output

Nothing

Analysis

The current unix user was added to the docker unix group.
After a logging out and in again I’m able to run docker without sudo like this:

Input

docker run hello-world

Output

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Analysis

It’s done, docker is installed 🙂

A lot of stuff learned!

I’ve been playing around a lot with the Stellaris Launchpad board, looking around the stuff I never noticed that the besides the fact of being licensed with a BSD style license, the Stellarisware SW provided by Texas Instruments has a closed license for the various examples.

The basic files needed to create a program for the board, and basically for all the ARM processors are the following with binutils and gcc:

  • The program you want contained in a .c file.
  • A linker script due to the fact you don’t have an operating system running.
  • A startup code file that zeroes the .bss segment variables, copies the .data segment to ram and setups the NVIC vector table.
  • A Makefile to build everything easily.

The program and the Makefile can be done with not much worries, but the linker script and the startup code are quite difficult, at least for me, to understand and set up properly.

So I ended up building from scratch the whole files needed and licensed them with a BSD license (Basically, do what you want with them, just give me credit I’m happy if someone find them useful, you can contribute, but don’t blame me if it doesn’t work lol)

You can find them in this Github repository

Continue reading “A lot of stuff learned!”

Stellaris Launchpad

So, I got my 2 stellaris launchpad boards from TI.

Launchpad
Stellaris Launchpad

Each board has 2 Stellaris LM4F120H5QR ARM Cortex-M4 MCUs. The nice thing it’s I’ve had them for less than 5$ with free shipment.

I’ve followed the getting started tutorial on a windows machine, as they suggested, using their Code Composer Studio 5, which is free for the launchpad board, with now limitation on code size or time.
I’ve noticed that the examples can be built with a GNU cross-toolchain for arm-none-eabi, like the codesourcery lite if you don’t want to build your own (Yeah, I’m lazy).
I just used my ubuntu pc to test that out, and it was kinda easy to build some sample!

First thing to do it’s downloading the toolchain from here, you’ll need to register on their site. The installation it’s pretty straightforward, just follow the instructions on the site, with the shell change and the adding of the bin directory to the path.

You can verify to have a working toolchain with this test:

arm-none-eabi-g++ –version

Next you need to download the StellarisWare software from here you’ll need to register in here too but also getting an approval.

After downloading the StellarisWare you should create a folder on your home directory:

cd
mkdir stellaris
cd stellaris

Then you just need to run unzip to extract inside your folder the content of the auto-extracting archive you downloaded.

unzip ../downloads/SW-EK-LM4F120XL-9453.exe

Then you’ll just have everything ready to work with that. Get inside a directory and just use make to build the project. The cross compiling and all the variables configurations are in the makedefs file in the stellarisware folder!

The only missing part until now it’s how you load to the compiled bin file into the microcontroller. On windows it can be achieved with the LMLoader program. In linux there’s no way at the moment usually with the ICDI controller on board, the only way it’s using a JTAG adapter connected on the breakout JTAG connector.

The nice thing it’s that there’s also a d DFU Bootloader on the chip, maybe with some work I could get it working and uhm that would be useful somehow.