amazon.rst 2.4 KB

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