How to install Docker on AWS EC2 instance with AMI (CE/EE Update)How to pre-install and pre-configure selinux...

Why is participating in the European Parliamentary elections used as a threat?

What the heck is gets(stdin) on site coderbyte?

How do you justify more code being written by following clean code practices?

Can I say "fingers" when referring to toes?

How to get directions in deep space?

Why is the principal energy of an electron lower for excited electrons in a higher energy state?

Ways of geometrical multiplication

Why didn’t Eve recognize the little cockroach as a living organism?

Identifying "long and narrow" polygons in with PostGIS

Grepping string, but include all non-blank lines following each grep match

What is the smallest number n> 5 so that 5 ^ n ends with "3125"?

How much do grades matter for a future academia position?

How many people need to be born every 8 years to sustain population?

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

How do I fix the group tension caused by my character stealing and possibly killing without provocation?

Proving an identity involving cross products and coplanar vectors

Do I have to know the General Relativity theory to understand the concept of inertial frame?

ContourPlot — How do I color by contour curvature?

Anime with legendary swords made from talismans and a man who could change them with a shattered body

Showing mass murder in a kid's book

Does Doodling or Improvising on the Piano Have Any Benefits?

Why would five hundred and five be same as one?

How do I tell my boss that I'm quitting in 15 days (a colleague left this week)

How to leave product feedback on macOS?



How to install Docker on AWS EC2 instance with AMI (CE/EE Update)


How to pre-install and pre-configure selinux in a kvm/qemu guest image using docker?AWS EC2 starting docker service causes disconnected from sshAmazon EC2 terminology - AMI vs. EBS vs. Snapshot vs. VolumeAMI with or without reboot on AWS EC2Given an EC2 instance with an EBS AMI, How can I update the AMI's snapshot?EC2 Update my existing AMIAWS EC2 Looses public Internet after install Visual Studio 2013Install keychain on Amazon Linux AMI?How does yum with Red Hat Network Subscription work inside the rhel Docker images?What is the right method to use Red Hat Software Collections on Amazon AWS EC2 instances?mysql on ec2 linux AMI crashed occasionallyQ: Unable to create 'live' snapshot of running KVM using virsh













24















What is the current way of installing Docker on an AWS EC2 instance running the AMI?
There has been an announcement of Docker Enterprise Edition and now I want to know if anything has changed.
Until now, I have been using yum install docker and do get a Docker versioned at 1.12.6, build 7392c3b/1.12.6 right now (3/3/2017). However, the Docker repository on GitHub tells me that there are already newer releases.



I remember the official Docker (package) repository having a package named docker-engine replacing docker some time ago and now they seem to split the package up into docker-ce and docker-ee, where e.g. "Docker Community Edition (Docker CE) is not supported on Red Hat Enterprise Linux." [Source]



So is or will it still be correct to use the above to get the latest stable Docker version on EC2 instances running the AMI or do I need to pull the package from somewhere else (and if so which one, CE or EE)?










share|improve this question




















  • 2





    Did you read the AWS documentation on how to install Docker standard? If so what part of it didn't work, or what issues didn't it address? docs.aws.amazon.com/AmazonECS/latest/developerguide/…

    – Tim
    Mar 4 '17 at 1:35













  • The question is whether I can continue to do it like this. As already mentioned it'll install me Docker versioned at 1.12 which is already one if not more minor version updates behind the latest stable release (1.13, before CE/EE) and I wonder if this is due to the usual repository update delay or because the guide and package simply being outdated which requires some replacement work done by me (e.g. somehow getting Docker from their own repository?). Also concerning the latest EE announcement which might change something...

    – mxscho
    Mar 5 '17 at 4:27













  • Running what AMI?

    – Michael Hampton
    Mar 5 '17 at 4:42











  • @MichaelHampton the latest one for HVM, Amazon Linux AMI 2016.09.1.

    – mxscho
    Mar 5 '17 at 4:45






  • 1





    I suppose Amazon will update it when they get around to it. Though you know of course that nobody should be using Amazon Linux for anything.

    – Michael Hampton
    Mar 5 '17 at 4:46
















24















What is the current way of installing Docker on an AWS EC2 instance running the AMI?
There has been an announcement of Docker Enterprise Edition and now I want to know if anything has changed.
Until now, I have been using yum install docker and do get a Docker versioned at 1.12.6, build 7392c3b/1.12.6 right now (3/3/2017). However, the Docker repository on GitHub tells me that there are already newer releases.



I remember the official Docker (package) repository having a package named docker-engine replacing docker some time ago and now they seem to split the package up into docker-ce and docker-ee, where e.g. "Docker Community Edition (Docker CE) is not supported on Red Hat Enterprise Linux." [Source]



So is or will it still be correct to use the above to get the latest stable Docker version on EC2 instances running the AMI or do I need to pull the package from somewhere else (and if so which one, CE or EE)?










share|improve this question




















  • 2





    Did you read the AWS documentation on how to install Docker standard? If so what part of it didn't work, or what issues didn't it address? docs.aws.amazon.com/AmazonECS/latest/developerguide/…

    – Tim
    Mar 4 '17 at 1:35













  • The question is whether I can continue to do it like this. As already mentioned it'll install me Docker versioned at 1.12 which is already one if not more minor version updates behind the latest stable release (1.13, before CE/EE) and I wonder if this is due to the usual repository update delay or because the guide and package simply being outdated which requires some replacement work done by me (e.g. somehow getting Docker from their own repository?). Also concerning the latest EE announcement which might change something...

    – mxscho
    Mar 5 '17 at 4:27













  • Running what AMI?

    – Michael Hampton
    Mar 5 '17 at 4:42











  • @MichaelHampton the latest one for HVM, Amazon Linux AMI 2016.09.1.

    – mxscho
    Mar 5 '17 at 4:45






  • 1





    I suppose Amazon will update it when they get around to it. Though you know of course that nobody should be using Amazon Linux for anything.

    – Michael Hampton
    Mar 5 '17 at 4:46














24












24








24


6






What is the current way of installing Docker on an AWS EC2 instance running the AMI?
There has been an announcement of Docker Enterprise Edition and now I want to know if anything has changed.
Until now, I have been using yum install docker and do get a Docker versioned at 1.12.6, build 7392c3b/1.12.6 right now (3/3/2017). However, the Docker repository on GitHub tells me that there are already newer releases.



I remember the official Docker (package) repository having a package named docker-engine replacing docker some time ago and now they seem to split the package up into docker-ce and docker-ee, where e.g. "Docker Community Edition (Docker CE) is not supported on Red Hat Enterprise Linux." [Source]



So is or will it still be correct to use the above to get the latest stable Docker version on EC2 instances running the AMI or do I need to pull the package from somewhere else (and if so which one, CE or EE)?










share|improve this question
















What is the current way of installing Docker on an AWS EC2 instance running the AMI?
There has been an announcement of Docker Enterprise Edition and now I want to know if anything has changed.
Until now, I have been using yum install docker and do get a Docker versioned at 1.12.6, build 7392c3b/1.12.6 right now (3/3/2017). However, the Docker repository on GitHub tells me that there are already newer releases.



I remember the official Docker (package) repository having a package named docker-engine replacing docker some time ago and now they seem to split the package up into docker-ce and docker-ee, where e.g. "Docker Community Edition (Docker CE) is not supported on Red Hat Enterprise Linux." [Source]



So is or will it still be correct to use the above to get the latest stable Docker version on EC2 instances running the AMI or do I need to pull the package from somewhere else (and if so which one, CE or EE)?







amazon-ec2 amazon-web-services installation docker amazon-ami






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 5 '17 at 4:35







mxscho

















asked Mar 3 '17 at 22:51









mxschomxscho

2521210




2521210








  • 2





    Did you read the AWS documentation on how to install Docker standard? If so what part of it didn't work, or what issues didn't it address? docs.aws.amazon.com/AmazonECS/latest/developerguide/…

    – Tim
    Mar 4 '17 at 1:35













  • The question is whether I can continue to do it like this. As already mentioned it'll install me Docker versioned at 1.12 which is already one if not more minor version updates behind the latest stable release (1.13, before CE/EE) and I wonder if this is due to the usual repository update delay or because the guide and package simply being outdated which requires some replacement work done by me (e.g. somehow getting Docker from their own repository?). Also concerning the latest EE announcement which might change something...

    – mxscho
    Mar 5 '17 at 4:27













  • Running what AMI?

    – Michael Hampton
    Mar 5 '17 at 4:42











  • @MichaelHampton the latest one for HVM, Amazon Linux AMI 2016.09.1.

    – mxscho
    Mar 5 '17 at 4:45






  • 1





    I suppose Amazon will update it when they get around to it. Though you know of course that nobody should be using Amazon Linux for anything.

    – Michael Hampton
    Mar 5 '17 at 4:46














  • 2





    Did you read the AWS documentation on how to install Docker standard? If so what part of it didn't work, or what issues didn't it address? docs.aws.amazon.com/AmazonECS/latest/developerguide/…

    – Tim
    Mar 4 '17 at 1:35













  • The question is whether I can continue to do it like this. As already mentioned it'll install me Docker versioned at 1.12 which is already one if not more minor version updates behind the latest stable release (1.13, before CE/EE) and I wonder if this is due to the usual repository update delay or because the guide and package simply being outdated which requires some replacement work done by me (e.g. somehow getting Docker from their own repository?). Also concerning the latest EE announcement which might change something...

    – mxscho
    Mar 5 '17 at 4:27













  • Running what AMI?

    – Michael Hampton
    Mar 5 '17 at 4:42











  • @MichaelHampton the latest one for HVM, Amazon Linux AMI 2016.09.1.

    – mxscho
    Mar 5 '17 at 4:45






  • 1





    I suppose Amazon will update it when they get around to it. Though you know of course that nobody should be using Amazon Linux for anything.

    – Michael Hampton
    Mar 5 '17 at 4:46








2




2





Did you read the AWS documentation on how to install Docker standard? If so what part of it didn't work, or what issues didn't it address? docs.aws.amazon.com/AmazonECS/latest/developerguide/…

– Tim
Mar 4 '17 at 1:35







Did you read the AWS documentation on how to install Docker standard? If so what part of it didn't work, or what issues didn't it address? docs.aws.amazon.com/AmazonECS/latest/developerguide/…

– Tim
Mar 4 '17 at 1:35















The question is whether I can continue to do it like this. As already mentioned it'll install me Docker versioned at 1.12 which is already one if not more minor version updates behind the latest stable release (1.13, before CE/EE) and I wonder if this is due to the usual repository update delay or because the guide and package simply being outdated which requires some replacement work done by me (e.g. somehow getting Docker from their own repository?). Also concerning the latest EE announcement which might change something...

– mxscho
Mar 5 '17 at 4:27







The question is whether I can continue to do it like this. As already mentioned it'll install me Docker versioned at 1.12 which is already one if not more minor version updates behind the latest stable release (1.13, before CE/EE) and I wonder if this is due to the usual repository update delay or because the guide and package simply being outdated which requires some replacement work done by me (e.g. somehow getting Docker from their own repository?). Also concerning the latest EE announcement which might change something...

– mxscho
Mar 5 '17 at 4:27















Running what AMI?

– Michael Hampton
Mar 5 '17 at 4:42





Running what AMI?

– Michael Hampton
Mar 5 '17 at 4:42













@MichaelHampton the latest one for HVM, Amazon Linux AMI 2016.09.1.

– mxscho
Mar 5 '17 at 4:45





@MichaelHampton the latest one for HVM, Amazon Linux AMI 2016.09.1.

– mxscho
Mar 5 '17 at 4:45




1




1





I suppose Amazon will update it when they get around to it. Though you know of course that nobody should be using Amazon Linux for anything.

– Michael Hampton
Mar 5 '17 at 4:46





I suppose Amazon will update it when they get around to it. Though you know of course that nobody should be using Amazon Linux for anything.

– Michael Hampton
Mar 5 '17 at 4:46










4 Answers
4






active

oldest

votes


















34














To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance).





  1. Update the packages on your instance



    [ec2-user ~]$ sudo yum update -y




  2. Install Docker



    [ec2-user ~]$ sudo yum install docker -y




  3. Start the Docker Service



    [ec2-user ~]$ sudo service docker start




  4. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.



    [ec2-user ~]$ sudo usermod -a -G docker ec2-user




You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.






share|improve this answer



















  • 3





    Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

    – mxscho
    May 27 '17 at 23:52













  • @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

    – user239558
    May 29 '17 at 11:16






  • 1





    Today yum install installs 17.03.1ce-1.50.amzn1

    – raarts
    Jul 14 '17 at 8:16



















5














The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.



The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.



yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.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
systemctl enable haveged
systemctl start haveged
systemctl enable docker
systemctl start docker
setenforce 1


Enable SELinux by modifying /etc/sysconfig/selinux to be



SELINUX=enforcing
SELINUXTYPE=targeted


Then reboot your instance by issuing shutdown -r now



Executing sudo docker version should yield as of the time of this posting...




Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:09:15 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.03.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:13:03 2018
OS/Arch: linux/amd64
Experimental: false





share|improve this answer





















  • 1





    Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

    – Suncatcher
    May 6 '18 at 13:13






  • 1





    I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

    – Archimedes Trajano
    May 6 '18 at 13:59






  • 1





    OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

    – Suncatcher
    May 6 '18 at 14:48













  • Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

    – Archimedes Trajano
    May 6 '18 at 16:08






  • 1





    Simple paranoia

    – Archimedes Trajano
    May 7 '18 at 14:22



















2














Per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html




The current Amazon ECS-optimized AMI
(amzn-ami-2017.09.j-amazon-ecs-optimized) consists of:




  • The latest minimal version of the Amazon Linux AMI

  • The latest version of the Amazon ECS container agent (1.17.2)

  • The recommended version of Docker for the latest Amazon ECS container agent (17.12.0-ce)

  • The latest version of the ecs-init package to run and monitor the Amazon ECS agent (1.17.2-1)




You can see the history at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-ami-versions.html






share|improve this answer































    0














    In addition to my previous answer. If you use Terraform, I have also created a Terraform module that can be used to create a Docker Swarm



    https://registry.terraform.io/modules/trajano/swarm-aws/docker



    The difference between the approach I had done previously vs the approach I am presently doing with the terraform module is to utilize the AWS provided Docker packages. This does not include the full docker-compose and what not, but you don't require those packages normally in a server.



    Because I am using the one Amazon had provided, it is no longer the latest 18.09 version but the 18.06 version. However, the set up is simpler and I don't have to play catch up to container-selinux.



    The only external dependency I use is EPEL to get haveged because you still need a good random source for some applications.



    I also relied on the AWS security groups rather than explicitly setting up firewalld and used the SELinux setting that is defaulted in the AMI image.





    share























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "2"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f836198%2fhow-to-install-docker-on-aws-ec2-instance-with-ami-ce-ee-update%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      34














      To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance).





      1. Update the packages on your instance



        [ec2-user ~]$ sudo yum update -y




      2. Install Docker



        [ec2-user ~]$ sudo yum install docker -y




      3. Start the Docker Service



        [ec2-user ~]$ sudo service docker start




      4. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.



        [ec2-user ~]$ sudo usermod -a -G docker ec2-user




      You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.






      share|improve this answer



















      • 3





        Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

        – mxscho
        May 27 '17 at 23:52













      • @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

        – user239558
        May 29 '17 at 11:16






      • 1





        Today yum install installs 17.03.1ce-1.50.amzn1

        – raarts
        Jul 14 '17 at 8:16
















      34














      To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance).





      1. Update the packages on your instance



        [ec2-user ~]$ sudo yum update -y




      2. Install Docker



        [ec2-user ~]$ sudo yum install docker -y




      3. Start the Docker Service



        [ec2-user ~]$ sudo service docker start




      4. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.



        [ec2-user ~]$ sudo usermod -a -G docker ec2-user




      You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.






      share|improve this answer



















      • 3





        Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

        – mxscho
        May 27 '17 at 23:52













      • @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

        – user239558
        May 29 '17 at 11:16






      • 1





        Today yum install installs 17.03.1ce-1.50.amzn1

        – raarts
        Jul 14 '17 at 8:16














      34












      34








      34







      To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance).





      1. Update the packages on your instance



        [ec2-user ~]$ sudo yum update -y




      2. Install Docker



        [ec2-user ~]$ sudo yum install docker -y




      3. Start the Docker Service



        [ec2-user ~]$ sudo service docker start




      4. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.



        [ec2-user ~]$ sudo usermod -a -G docker ec2-user




      You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.






      share|improve this answer













      To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance).





      1. Update the packages on your instance



        [ec2-user ~]$ sudo yum update -y




      2. Install Docker



        [ec2-user ~]$ sudo yum install docker -y




      3. Start the Docker Service



        [ec2-user ~]$ sudo service docker start




      4. Add the ec2-user to the docker group so you can execute Docker commands without using sudo.



        [ec2-user ~]$ sudo usermod -a -G docker ec2-user




      You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered May 25 '17 at 21:21









      ajtrichardsajtrichards

      46466




      46466








      • 3





        Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

        – mxscho
        May 27 '17 at 23:52













      • @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

        – user239558
        May 29 '17 at 11:16






      • 1





        Today yum install installs 17.03.1ce-1.50.amzn1

        – raarts
        Jul 14 '17 at 8:16














      • 3





        Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

        – mxscho
        May 27 '17 at 23:52













      • @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

        – user239558
        May 29 '17 at 11:16






      • 1





        Today yum install installs 17.03.1ce-1.50.amzn1

        – raarts
        Jul 14 '17 at 8:16








      3




      3





      Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

      – mxscho
      May 27 '17 at 23:52







      Like I already mentioned in the question, this indeed works, but installs an outdated version of Docker (still version 1.12.6 on 05/28/2017). While I myself have switched to the Ubuntu image for my EC2 instances, the real thing I wanted to know is how to install one of the current versions of Docker on an AMI image. Because there (at least at the time of the question) was no obvious way to either get an up-to-date Docker CE or a Docker EE installation. That is what this question was about in the first place and that's the reason why I cannot accept it without hesitation. Thank you anyways!

      – mxscho
      May 27 '17 at 23:52















      @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

      – user239558
      May 29 '17 at 11:16





      @mxscho yes that's also what I'm looking for, so please wait until an answer that addresses the question is posted.

      – user239558
      May 29 '17 at 11:16




      1




      1





      Today yum install installs 17.03.1ce-1.50.amzn1

      – raarts
      Jul 14 '17 at 8:16





      Today yum install installs 17.03.1ce-1.50.amzn1

      – raarts
      Jul 14 '17 at 8:16













      5














      The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.



      The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.



      yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
      yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.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
      systemctl enable haveged
      systemctl start haveged
      systemctl enable docker
      systemctl start docker
      setenforce 1


      Enable SELinux by modifying /etc/sysconfig/selinux to be



      SELINUX=enforcing
      SELINUXTYPE=targeted


      Then reboot your instance by issuing shutdown -r now



      Executing sudo docker version should yield as of the time of this posting...




      Client:
      Version: 18.03.0-ce
      API version: 1.37
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:09:15 2018
      OS/Arch: linux/amd64
      Experimental: false
      Orchestrator: swarm

      Server:
      Engine:
      Version: 18.03.0-ce
      API version: 1.37 (minimum version 1.12)
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:13:03 2018
      OS/Arch: linux/amd64
      Experimental: false





      share|improve this answer





















      • 1





        Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

        – Suncatcher
        May 6 '18 at 13:13






      • 1





        I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

        – Archimedes Trajano
        May 6 '18 at 13:59






      • 1





        OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

        – Suncatcher
        May 6 '18 at 14:48













      • Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

        – Archimedes Trajano
        May 6 '18 at 16:08






      • 1





        Simple paranoia

        – Archimedes Trajano
        May 7 '18 at 14:22
















      5














      The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.



      The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.



      yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
      yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.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
      systemctl enable haveged
      systemctl start haveged
      systemctl enable docker
      systemctl start docker
      setenforce 1


      Enable SELinux by modifying /etc/sysconfig/selinux to be



      SELINUX=enforcing
      SELINUXTYPE=targeted


      Then reboot your instance by issuing shutdown -r now



      Executing sudo docker version should yield as of the time of this posting...




      Client:
      Version: 18.03.0-ce
      API version: 1.37
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:09:15 2018
      OS/Arch: linux/amd64
      Experimental: false
      Orchestrator: swarm

      Server:
      Engine:
      Version: 18.03.0-ce
      API version: 1.37 (minimum version 1.12)
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:13:03 2018
      OS/Arch: linux/amd64
      Experimental: false





      share|improve this answer





















      • 1





        Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

        – Suncatcher
        May 6 '18 at 13:13






      • 1





        I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

        – Archimedes Trajano
        May 6 '18 at 13:59






      • 1





        OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

        – Suncatcher
        May 6 '18 at 14:48













      • Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

        – Archimedes Trajano
        May 6 '18 at 16:08






      • 1





        Simple paranoia

        – Archimedes Trajano
        May 7 '18 at 14:22














      5












      5








      5







      The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.



      The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.



      yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
      yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.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
      systemctl enable haveged
      systemctl start haveged
      systemctl enable docker
      systemctl start docker
      setenforce 1


      Enable SELinux by modifying /etc/sysconfig/selinux to be



      SELINUX=enforcing
      SELINUXTYPE=targeted


      Then reboot your instance by issuing shutdown -r now



      Executing sudo docker version should yield as of the time of this posting...




      Client:
      Version: 18.03.0-ce
      API version: 1.37
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:09:15 2018
      OS/Arch: linux/amd64
      Experimental: false
      Orchestrator: swarm

      Server:
      Engine:
      Version: 18.03.0-ce
      API version: 1.37 (minimum version 1.12)
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:13:03 2018
      OS/Arch: linux/amd64
      Experimental: false





      share|improve this answer















      The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.



      The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.



      yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
      yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.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
      systemctl enable haveged
      systemctl start haveged
      systemctl enable docker
      systemctl start docker
      setenforce 1


      Enable SELinux by modifying /etc/sysconfig/selinux to be



      SELINUX=enforcing
      SELINUXTYPE=targeted


      Then reboot your instance by issuing shutdown -r now



      Executing sudo docker version should yield as of the time of this posting...




      Client:
      Version: 18.03.0-ce
      API version: 1.37
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:09:15 2018
      OS/Arch: linux/amd64
      Experimental: false
      Orchestrator: swarm

      Server:
      Engine:
      Version: 18.03.0-ce
      API version: 1.37 (minimum version 1.12)
      Go version: go1.9.4
      Git commit: 0520e24
      Built: Wed Mar 21 23:13:03 2018
      OS/Arch: linux/amd64
      Experimental: false






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 27 '18 at 8:01

























      answered Apr 5 '18 at 21:47









      Archimedes TrajanoArchimedes Trajano

      199110




      199110








      • 1





        Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

        – Suncatcher
        May 6 '18 at 13:13






      • 1





        I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

        – Archimedes Trajano
        May 6 '18 at 13:59






      • 1





        OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

        – Suncatcher
        May 6 '18 at 14:48













      • Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

        – Archimedes Trajano
        May 6 '18 at 16:08






      • 1





        Simple paranoia

        – Archimedes Trajano
        May 7 '18 at 14:22














      • 1





        Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

        – Suncatcher
        May 6 '18 at 13:13






      • 1





        I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

        – Archimedes Trajano
        May 6 '18 at 13:59






      • 1





        OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

        – Suncatcher
        May 6 '18 at 14:48













      • Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

        – Archimedes Trajano
        May 6 '18 at 16:08






      • 1





        Simple paranoia

        – Archimedes Trajano
        May 7 '18 at 14:22








      1




      1





      Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

      – Suncatcher
      May 6 '18 at 13:13





      Have you tried running Docker on any other AMIs except CentOS? Can you share your expriences?

      – Suncatcher
      May 6 '18 at 13:13




      1




      1





      I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

      – Archimedes Trajano
      May 6 '18 at 13:59





      I didn't use the centos Ami I used the AMI Linux 2. The Linux 1 is too old.

      – Archimedes Trajano
      May 6 '18 at 13:59




      1




      1





      OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

      – Suncatcher
      May 6 '18 at 14:48







      OK, got it. Are CentOS repos you used fully compatible with Amazon AMI?

      – Suncatcher
      May 6 '18 at 14:48















      Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

      – Archimedes Trajano
      May 6 '18 at 16:08





      Right I use Centos VMs for development using Vagrant, I just had to adapt my scripts so that it works with missing packages.

      – Archimedes Trajano
      May 6 '18 at 16:08




      1




      1





      Simple paranoia

      – Archimedes Trajano
      May 7 '18 at 14:22





      Simple paranoia

      – Archimedes Trajano
      May 7 '18 at 14:22











      2














      Per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html




      The current Amazon ECS-optimized AMI
      (amzn-ami-2017.09.j-amazon-ecs-optimized) consists of:




      • The latest minimal version of the Amazon Linux AMI

      • The latest version of the Amazon ECS container agent (1.17.2)

      • The recommended version of Docker for the latest Amazon ECS container agent (17.12.0-ce)

      • The latest version of the ecs-init package to run and monitor the Amazon ECS agent (1.17.2-1)




      You can see the history at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-ami-versions.html






      share|improve this answer




























        2














        Per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html




        The current Amazon ECS-optimized AMI
        (amzn-ami-2017.09.j-amazon-ecs-optimized) consists of:




        • The latest minimal version of the Amazon Linux AMI

        • The latest version of the Amazon ECS container agent (1.17.2)

        • The recommended version of Docker for the latest Amazon ECS container agent (17.12.0-ce)

        • The latest version of the ecs-init package to run and monitor the Amazon ECS agent (1.17.2-1)




        You can see the history at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-ami-versions.html






        share|improve this answer


























          2












          2








          2







          Per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html




          The current Amazon ECS-optimized AMI
          (amzn-ami-2017.09.j-amazon-ecs-optimized) consists of:




          • The latest minimal version of the Amazon Linux AMI

          • The latest version of the Amazon ECS container agent (1.17.2)

          • The recommended version of Docker for the latest Amazon ECS container agent (17.12.0-ce)

          • The latest version of the ecs-init package to run and monitor the Amazon ECS agent (1.17.2-1)




          You can see the history at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-ami-versions.html






          share|improve this answer













          Per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html




          The current Amazon ECS-optimized AMI
          (amzn-ami-2017.09.j-amazon-ecs-optimized) consists of:




          • The latest minimal version of the Amazon Linux AMI

          • The latest version of the Amazon ECS container agent (1.17.2)

          • The recommended version of Docker for the latest Amazon ECS container agent (17.12.0-ce)

          • The latest version of the ecs-init package to run and monitor the Amazon ECS agent (1.17.2-1)




          You can see the history at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-ami-versions.html







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 16 '18 at 0:15









          PlutextPlutext

          13318




          13318























              0














              In addition to my previous answer. If you use Terraform, I have also created a Terraform module that can be used to create a Docker Swarm



              https://registry.terraform.io/modules/trajano/swarm-aws/docker



              The difference between the approach I had done previously vs the approach I am presently doing with the terraform module is to utilize the AWS provided Docker packages. This does not include the full docker-compose and what not, but you don't require those packages normally in a server.



              Because I am using the one Amazon had provided, it is no longer the latest 18.09 version but the 18.06 version. However, the set up is simpler and I don't have to play catch up to container-selinux.



              The only external dependency I use is EPEL to get haveged because you still need a good random source for some applications.



              I also relied on the AWS security groups rather than explicitly setting up firewalld and used the SELinux setting that is defaulted in the AMI image.





              share




























                0














                In addition to my previous answer. If you use Terraform, I have also created a Terraform module that can be used to create a Docker Swarm



                https://registry.terraform.io/modules/trajano/swarm-aws/docker



                The difference between the approach I had done previously vs the approach I am presently doing with the terraform module is to utilize the AWS provided Docker packages. This does not include the full docker-compose and what not, but you don't require those packages normally in a server.



                Because I am using the one Amazon had provided, it is no longer the latest 18.09 version but the 18.06 version. However, the set up is simpler and I don't have to play catch up to container-selinux.



                The only external dependency I use is EPEL to get haveged because you still need a good random source for some applications.



                I also relied on the AWS security groups rather than explicitly setting up firewalld and used the SELinux setting that is defaulted in the AMI image.





                share


























                  0












                  0








                  0







                  In addition to my previous answer. If you use Terraform, I have also created a Terraform module that can be used to create a Docker Swarm



                  https://registry.terraform.io/modules/trajano/swarm-aws/docker



                  The difference between the approach I had done previously vs the approach I am presently doing with the terraform module is to utilize the AWS provided Docker packages. This does not include the full docker-compose and what not, but you don't require those packages normally in a server.



                  Because I am using the one Amazon had provided, it is no longer the latest 18.09 version but the 18.06 version. However, the set up is simpler and I don't have to play catch up to container-selinux.



                  The only external dependency I use is EPEL to get haveged because you still need a good random source for some applications.



                  I also relied on the AWS security groups rather than explicitly setting up firewalld and used the SELinux setting that is defaulted in the AMI image.





                  share













                  In addition to my previous answer. If you use Terraform, I have also created a Terraform module that can be used to create a Docker Swarm



                  https://registry.terraform.io/modules/trajano/swarm-aws/docker



                  The difference between the approach I had done previously vs the approach I am presently doing with the terraform module is to utilize the AWS provided Docker packages. This does not include the full docker-compose and what not, but you don't require those packages normally in a server.



                  Because I am using the one Amazon had provided, it is no longer the latest 18.09 version but the 18.06 version. However, the set up is simpler and I don't have to play catch up to container-selinux.



                  The only external dependency I use is EPEL to get haveged because you still need a good random source for some applications.



                  I also relied on the AWS security groups rather than explicitly setting up firewalld and used the SELinux setting that is defaulted in the AMI image.






                  share











                  share


                  share










                  answered 9 mins ago









                  Archimedes TrajanoArchimedes Trajano

                  199110




                  199110






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Server Fault!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f836198%2fhow-to-install-docker-on-aws-ec2-instance-with-ami-ce-ee-update%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                      Список ссавців Італії Природоохоронні статуси | Список |...

                      Українські прізвища Зміст Історичні відомості |...