Installing the latest version of Docker on CentOS 7 minimal

Posted by

I’ve been playing with docker lately and usually I want to have the latest version available as it brings bug fixes and enhancements, but I find that docker is released so quickly that the distribution releases lag behind the latest version a little bit.  Since I’ve had to repeat this process twice, I figured I’d document it and since I’m documenting it, I’d create a post.  There is nothing groundbreaking here, but it should get you up and running with the latest version of docker quickly.  The commands could be added to a simple bash script or you could create a Puppet manifest out of them.  See here for more info on installing Docker on CentOS.

Installing Docker

Download the latest version of docker:

curl -o /usr/bin/docker

Make the docker binary executable:

chmod +x /usr/bin/docker

We need to get some systemd files from here.

Download docker.service into the systemd directory:

curl -o /etc/systemd/system/docker.service

Download docker.socker into the systemd directory:

curl -o /etc/systemd/system/docker.socket

Enable the docker service

systemctl enable docker.service

Start docker

systemctl start docker.service

Verify the docker version (1.6.1 at this time):

docker -v

Docker version 1.6.1, build 97cd073

Here are each of the commands:

curl -o /usr/bin/docker
chmod +x /usr/bin/docker
curl -o /etc/systemd/system/docker.service
curl -o /etc/systemd/system/docker.socket
systemctl enable docker.service
systemctl start docker.service

Create a new image and container

Create a simple Dockerfile with the contents of:

FROM ubuntu:14.04
MAINTAINER Chris Greene <chris@vmware.local>
RUN apt-get -yqq update
RUN apt-get -yqq install

Build the docker image:

docker build -t chrisgreene/test .

View images:

docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
chrisgreene/test    latest              4b88ac6b0f60        2 minutes ago       209.1 MB
ubuntu                   14.04               07f8e8c5e660             12 days ago      188.3 MB

Create a container from the image:

docker run -it chrisgreene/test /bin/bash

View some info in the container:

cat /etc/os-release

VERSION=”14.04.2 LTS, Trusty Tahr
PRETTY_NAME=”Ubuntu 14.04.2 LTS”

If you’d like a book on docker but are worried about it getting out of date quickly, checkout James Turnbull’s “The Docker Book“.  When docker 1.5 came out I received an email from James on the same day announcing that version 1.5 of his book was out.  The home page still list v1.5 but on the downloads page it is v1.6.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s