Install Docker

What is Docker?

In short:

“An open source project to pack, ship and run any application as a lightweight container.”

In practice Docker

  • povide an isolated sharable environment (dev and ship)
  • allow to change dev env without messing-up the host OS
  • ease an app installation
  • is based on lxc (linux containers) and Go
  • remove the need of a virtual machines, it can be used in a similar way but it is different → much more lightweight
  • is (quite) secure (everything is sandboxed), though I don’t like its process run as root
  • allow you to commit changes
  • is based on images and containers: templates and running instances (that lose memory on shutdown

I don’t want to write an essay on Docker, just present it briefly and describe the best (in my opinion) way to install it on *buntu. However, I think it is one of the solution (see also LXD containers) science should look at when dealing with reproducibility, easiness, sharing and so on.

Docker installation

See also here.

Add docker repository key to apt-key for package verification and add repository:

sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"

Install docker

sudo aptitude update && sudo aptitude install lxc-docker

Avoid typing sudo everytime

sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo service docker restart

then logout and login again.

Allow memory limits: set /etc/default/grub key GRUB_CMDLINE_LINUX to

GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

then update GRUB with sudo update-grub and reboot.

Useful commands

Other resources

More Reading
Newer// Instagram!!
comments powered by Disqus