8

I want to upgrade Docker to v1.8 on Amazon Linux.

At the time of writing their internal yum package repository has: Docker version 1.7.1, build 786b29d/1.7.1.

Things I have already tried

Manually installing from the Docker project's repo

Error: Package: docker-engine-1.8.2-1.el7.centos.x86_64 (dockerrepo) Requires: systemd-units

Hzmy
  • 769
  • 7
  • 16
  • Think you out of luck here. Amazon Linux was forked from CentOS 5 and has changed very significantly over the last few years. And some Centos7 packages might not be compatible. So you can ether try different Linux distribution (Centos7, Ubuntu, Fedora) or just wait unitl Amazon updates it's ami. – Vor Sep 17 '15 at 21:12
  • I'm giving a go at installing Docker from source now. If that fails I'll open up the Amazon `docker` yum package and tweak it. – Hzmy Sep 17 '15 at 21:59

4 Answers4

4

If you're using the EC2 Container service, the AWS ECS-optimized AMI (2015.09.b) is running docker-1.7.1 as of this writing. A post in the AWS forums states "[AWS is] testing 1.9 RC and plan to deliver it this month."

To expand on Hzmy's answer, here's how to upgrade Docker to 1.9.0 in an SSH session:

service docker stop
cp /usr/bin/docker /usr/bin/docker.old
curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.9.0
service docker start

If you're using CloudFormation templates, here's a command you can drop in your AWS::Cloudformation::Init:

...
"commands": {
    ...,
    "03_upgrade_docker_for_log_driver_support": {
        "command": {
            "Fn::Join": [
                "",
                [
                    "#!/bin/bash -xe\n",
                    "service docker stop\n",
                    "cp /usr/bin/docker /usr/bin/docker.old\n",
                    "curl -o /usr/bin/docker https://get.docker.com/builds/Linux/x86_64/docker-1.8.3\n",
                    "service docker start\n"
                ]
            ]
        }
    }
    ...
}
...

Maybe not the cleanest, but it seems to work for me.

Pete
  • 10,310
  • 7
  • 53
  • 59
  • yup! As long as Docker doesn't change anything crazy with their init scripts - it should be all good! – Hzmy Nov 24 '15 at 21:55
3

I ended up installing the Amazon Linux docker package and then overwriting the /usr/bin/docker binary with the 1.8.2 version binary from: https://docs.docker.com/installation/binaries/.

Not exactly elegant - but all of the dependencies are the same, and seeing as my AMI is immutable the package won't be upgraded on top of the current image.

Hzmy
  • 769
  • 7
  • 16
1

I just put this answer here for more people to find it, but all the credits to Archimedes Trajano.

The only thing I corrected is that haveged installation is not necessary on the latest Amazon Linux 2 LTS Candidate. Also, since SELinux is disabled by default on Amazon Linux, so all the steps realated to SELinux are not necessary too, but container-selinux is required by docker-ce, so it must be installed anyway. Firewall enabling is optional here.

So, final steps for latest Amazon 2 AMI could look like this:

yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.99-1.el7.noarch.rpm
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -q -y firewalld docker-ce
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
firewall-cmd --zone=public --permanent --add-masquerade
firewall-cmd --reload
usermod -a -G docker ec2-user
systemctl enable docker
systemctl start docker

All the steps should be ran with sudo. Non-sudo docker run will be available after reboot/relogin upon execution of these commands.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
1

Updating docker to the lastest version worked for me

sudo yum upgrade docker
Skatox
  • 4,237
  • 12
  • 42
  • 47
richytong
  • 2,387
  • 1
  • 10
  • 21