Docker logo

Manual installation of Docker on Debian/Ubuntu

I've played with Docker a little in it early days but didn't stick for longer with it. It's stable now so I wanted to check how it's running now.

I really can't accept this method of installation:

$ curl -fsSL https://get.docker.com/ | sh

I think that world is going to it's end when I see such scritps… I prefer to do this manually, knowing exactly what I have to do.

Install prerequisites:

apt-get update
apt-get install -y apt-transport-https ca-certificates

Purge old packages if you used them:

apt-get purge lxc-docker*
apt-get purge docker.io*

Add GPG key:

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

Add repo – use ONLY ONE repo appropriate for your system (lsb_release -a to check):

echo "deb https://apt.dockerproject.org/repo debian-wheezy main" > /etc/apt/sources.list.d/docker.list
echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list
echo "deb https://apt.dockerproject.org/repo debian-stretch main" > /etc/apt/sources.list.d/docker.list
echo "deb https://apt.dockerproject.org/repo ubuntu-precise main" > /etc/apt/sources.list.d/docker.list
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list

Refresh repos and install Docker:

apt-get update
apt-get install -y docker-engine

Start service if it's not running:

service docker start

Grant access to docker service for non-root user

I don't like to use apps that require me to use root account. Docker even advice not to do so – service is running as root and you should add docker group and user to it to grant access to service socket:

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

Now logout, login again and and you should be able to use docker command:

docker version
docker info
docker run hello-world

Have fun 🙂

Source:
https://docs.docker.com/linux/
https://docs.docker.com/engine/installation/

Leave a Reply

Your email address will not be published. Required fields are marked *