amazon.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. :title: Installation on Amazon EC2
  2. :description: Docker installation on Amazon EC2 with a single vagrant command. Vagrant 1.1 or higher is required.
  3. :keywords: amazon ec2, virtualization, cloud, docker, documentation, installation
  4. Amazon EC2
  5. ==========
  6. Please note this is a community contributed installation path. The only 'official' installation is using the
  7. :ref:`ubuntu_linux` installation path. This version may sometimes be out of date.
  8. Installation
  9. ------------
  10. Docker can now be installed on Amazon EC2 with a single vagrant command. Vagrant 1.1 or higher is required.
  11. 1. Install vagrant from http://www.vagrantup.com/ (or use your package manager)
  12. 2. Install the vagrant aws plugin
  13. ::
  14. vagrant plugin install vagrant-aws
  15. 3. Get the docker sources, this will give you the latest Vagrantfile.
  16. ::
  17. git clone https://github.com/dotcloud/docker.git
  18. 4. Check your AWS environment.
  19. Create a keypair specifically for EC2, give it a name and save it to your disk. *I usually store these in my ~/.ssh/ folder*.
  20. Check that your default security group has an inbound rule to accept SSH (port 22) connections.
  21. 5. Inform Vagrant of your settings
  22. Vagrant will read your access credentials from your environment, so we need to set them there first. Make sure
  23. you have everything on amazon aws setup so you can (manually) deploy a new image to EC2.
  24. ::
  25. export AWS_ACCESS_KEY_ID=xxx
  26. export AWS_SECRET_ACCESS_KEY=xxx
  27. export AWS_KEYPAIR_NAME=xxx
  28. export AWS_SSH_PRIVKEY=xxx
  29. The environment variables are:
  30. * ``AWS_ACCESS_KEY_ID`` - The API key used to make requests to AWS
  31. * ``AWS_SECRET_ACCESS_KEY`` - The secret key to make AWS API requests
  32. * ``AWS_KEYPAIR_NAME`` - The name of the keypair used for this EC2 instance
  33. * ``AWS_SSH_PRIVKEY`` - The path to the private key for the named keypair, for example ``~/.ssh/docker.pem``
  34. You can check if they are set correctly by doing something like
  35. ::
  36. echo $AWS_ACCESS_KEY_ID
  37. 6. Do the magic!
  38. ::
  39. vagrant up --provider=aws
  40. If it stalls indefinitely on ``[default] Waiting for SSH to become available...``, Double check your default security
  41. zone on AWS includes rights to SSH (port 22) to your container.
  42. If you have an advanced AWS setup, you might want to have a look at https://github.com/mitchellh/vagrant-aws
  43. 7. Connect to your machine
  44. .. code-block:: bash
  45. vagrant ssh
  46. 8. Your first command
  47. Now you are in the VM, run docker
  48. .. code-block:: bash
  49. docker
  50. Continue with the :ref:`hello_world` example.