Tuesday, 22 July 2014

Using docker on Linux Mint Debian Edition

Installing Docker on LMDE takes a few steps and will require that we add a third-party repository.

Note: We will be logged in as root to issue these commands. Also, I am by no means an expert on this, I am learning this as I go on.

So, with that out of the way let's add the key for the get.docker.io repository;

# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Next add the repository to your apt sources;

# echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list

Update apt;

# apt-get update

Install docker;

# apt-get install lxc-docker

Verify that it has worked by downloading and running the ubuntu container;

# docker run -i -t ubuntu /bin/bash
Unable to find image 'ubuntu' locally
Pulling repository ubuntu
e54ca5efa2e9: Download complete
511136ea3c5a: Download complete
d7ac5e4f1812: Download complete
2f4b4d6a4a06: Download complete
83ff768040a0: Download complete
6c37f792ddac: Download complete

Congratulations you are sitting in bash inside your ubuntu container. Type 'exit' or use ctrl-d to exit.

Note: It is important to understand that once you exit a container it ceases to run unless you specifically tell it not to (see below). It is not like a normal virtual machine that keeps on running in the background until you shut it down. To exit a container and have it remain running, use ctrl-p followed by crtl-q.

You probably dont want to be the root user every time you use docker. In that case simply add your user to the docker group;

# usermod -a -G docker myusername

You can list all the running containers with the 'docker ps' command. Add '-a to see the stopped ones as well.

Note: The containers that you create are kept in '/var/lib/docker/containers'

That's the basics of docker. The next thing to learn more about is using docker files to build containers.


Anonymous said...

This is correct for lmde? Why are we using Ubuntu repositories instead of debian ones?

Brett said...

Yes, this is correct. We are not using "Ubuntu repositories" we are using the Docker.io repository which doesn't have a debian or lmde section so, we must use the ubuntu section of their repository.

yaroska said...

I have some problems to start container up: FATA[0000] Error response from daemon: Cannot start container XX_HASH_XX: open /dev/cgroup/cpuset/docker/cpuset.cpus: no such file or directory