User data to install and run Docker in an Ubuntu AWS instance

by Marc Cortada 21/05/2017

This snippet is based in Ubuntu 16.04.2 version.

After running this script docker will be installed in your Amazon Web Services instance.

Some attention points:

  • These commands are executed in background when the instance is running and could take some time to finish. If you login just when the instance is available the installation could be not ready yet.

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

curl -fsSL | apt-key add -

add-apt-repository \
       "deb [arch=amd64] \
       $(lsb_release -cs) \

apt-get update

apt-get -y install docker-ce
When the machine is running and the execution is finished you can run:
docker run hello-world
This snippet is based in the info available here:


Categorías: Amazon Web Services (AWS) | AWS User Data | Developing and programming | Docker

Entradas por mes