|
| 1 | +:title: Deploying Docker Images on Deis |
| 2 | +:description: How to deploy applications on Deis using Docker Images |
| 3 | + |
| 4 | +.. _using-docker-images: |
| 5 | + |
| 6 | +Using Docker Images |
| 7 | +=================== |
| 8 | +Deis supports deploying applications via an existing `Docker Image`_. |
| 9 | +This is useful for integrating Deis into Docker-based CI/CD pipelines. |
| 10 | + |
| 11 | +Prepare an Application |
| 12 | +---------------------- |
| 13 | +Start by cloning an example application: |
| 14 | + |
| 15 | +.. code-block:: console |
| 16 | +
|
| 17 | + $ git clone https://github.com/deis/example-go.git |
| 18 | + $ cd example-go |
| 19 | + $ git checkout docker |
| 20 | +
|
| 21 | +Next use your local ``docker`` client to build the image and push |
| 22 | +it to `DockerHub`_. |
| 23 | + |
| 24 | +.. code-block:: console |
| 25 | +
|
| 26 | + $ docker build -t <username>/example-go . |
| 27 | + $ docker push <username>/example-go |
| 28 | +
|
| 29 | +Docker Image Requirements |
| 30 | +^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | +In order to deploy Docker images, they must conform to the following requirements: |
| 32 | + |
| 33 | + * The Docker image must EXPOSE only one port |
| 34 | + * The exposed port must be an HTTP service that can be connected to an HTTP router |
| 35 | + * A default CMD must be specified for running the container |
| 36 | + |
| 37 | +.. note:: |
| 38 | + |
| 39 | + Docker images which expose more than one port will hit `issue 1156`_. |
| 40 | + |
| 41 | +.. attention:: |
| 42 | + |
| 43 | + Support for non-HTTP services is coming soon |
| 44 | + |
| 45 | +Create an Application |
| 46 | +--------------------- |
| 47 | +Use ``deis create`` to create an application on the :ref:`controller`. |
| 48 | + |
| 49 | +.. code-block:: console |
| 50 | +
|
| 51 | + $ mkdir -p /tmp/example-go && cd /tmp/example-go |
| 52 | + $ deis create |
| 53 | + Creating application... done, created example-go |
| 54 | +
|
| 55 | +.. note:: |
| 56 | + |
| 57 | + The ``deis`` client uses the name of the current directory as the |
| 58 | + default app name. |
| 59 | + |
| 60 | +Deploy the Application |
| 61 | +---------------------- |
| 62 | +Use ``deis pull`` to deploy your application from `DockerHub`_ or |
| 63 | +a private registry. |
| 64 | + |
| 65 | +.. code-block:: console |
| 66 | +
|
| 67 | + $ deis pull gabrtv/example-go:latest |
| 68 | + Creating build... done, v2 |
| 69 | +
|
| 70 | + $ curl -s http://example-go.local3.deisapp.com |
| 71 | + Powered by Deis |
| 72 | +
|
| 73 | +Because you are deploying a Docker image, the ``cmd`` process type is automatically scaled to 1 on first deploy. |
| 74 | + |
| 75 | +.. attention:: |
| 76 | + |
| 77 | + Support for Docker registry authentication is coming soon |
| 78 | + |
| 79 | +Define Process Types |
| 80 | +-------------------- |
| 81 | +Docker containers have a default command usually specified by a `CMD instruction`_. |
| 82 | +Deis uses the ``cmd`` process type to refer to this default command. |
| 83 | + |
| 84 | +Process types other than ``cmd`` are not supported when using Docker images. |
| 85 | + |
| 86 | + |
| 87 | +.. _`Docker Image`: http://docs.docker.io/introduction/understanding-docker/ |
| 88 | +.. _`DockerHub`: https://registry.hub.docker.com/ |
| 89 | +.. _`CMD instruction`: http://docs.docker.io/reference/builder/#cmd |
| 90 | +.. _`issue 1156`: https://github.com/deis/deis/issues/1156 |
0 commit comments