github.com/chasestarr/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/docs/using_deis/using-docker-images.rst (about)

     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 port must be listening for a HTTP connection
    35  * A default CMD must be specified for running the container
    36  * Bash should be available in the Docker image
    37  
    38  .. note::
    39  
    40      Docker images which expose more than one port will hit `issue 1156`_.
    41  
    42  Create an Application
    43  ---------------------
    44  Use ``deis create`` to create an application on the :ref:`controller`.
    45  
    46  .. code-block:: console
    47  
    48      $ mkdir -p /tmp/example-go && cd /tmp/example-go
    49      $ deis create
    50      Creating application... done, created example-go
    51  
    52  .. note::
    53  
    54      The ``deis`` client uses the name of the current directory as the
    55      default app name.
    56  
    57  Deploy the Application
    58  ----------------------
    59  Use ``deis pull`` to deploy your application from `DockerHub`_ or
    60  a private registry.
    61  
    62  .. code-block:: console
    63  
    64      $ deis pull gabrtv/example-go:latest
    65      Creating build...  done, v2
    66  
    67      $ curl -s http://example-go.local3.deisapp.com
    68      Powered by Deis
    69  
    70  Because you are deploying a Docker image, the ``cmd`` process type is automatically scaled to 1 on first deploy.
    71  
    72  Use ``deis scale cmd=3`` to increase ``cmd`` processes to 3, for example. Scaling a
    73  process type directly changes the number of :ref:`Containers <container>`
    74  running that process.
    75  
    76  
    77  .. attention::
    78  
    79      Support for Docker registry authentication is coming soon
    80  
    81  
    82  .. _`Docker Image`: https://docs.docker.com/introduction/understanding-docker/
    83  .. _`DockerHub`: https://registry.hub.docker.com/
    84  .. _`CMD instruction`: https://docs.docker.com/reference/builder/#cmd
    85  .. _`issue 1156`: https://github.com/deis/deis/issues/1156