Upgrading Docker on Amazon Linux AMI

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.

  • docker centos:6.6 image “/bin/sh: java: command not found” java is installed
  • Dockerfile fails to build
  • Keeping a Play framework app running in a Docker container without a pseudo-TTY
  • How to create docker machine with specific version?
  • connecting APIMAN to an external ElasticSearch database for metrics
  • Have sshd forward logins of git user to a (GitLab) Docker container
  • 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

  • How to get Docker to run on a Windows System behind a corporate firewall?
  • Get dockerfile / docker commands from docker image
  • docker for windows equivalent for “-v /var/run/docker.sock:/var/run/docker.sock”
  • Docker: Dockerizing apache virtual hosts
  • How to put ownCloud behind Nginx with Docker?
  • Can't install Kubernetes on Vagrant
  • 2 Solutions collect form web for “Upgrading Docker on Amazon Linux AMI”

    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.

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.