github.com/deis/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/docs/using_deis/using-dockerfiles.rst (about) 1 :title: Deploying with Dockerfiles on Deis 2 :description: How to deploy applications on Deis using Dockerfiles 3 4 .. _using-dockerfiles: 5 6 Using Dockerfiles 7 ================= 8 Deis supports deploying applications via Dockerfiles. A `Dockerfile`_ automates the steps for crafting a `Docker Image`_. 9 Dockerfiles are incredibly powerful but require some extra work to define your exact application runtime environment. 10 11 Prepare an Application 12 ---------------------- 13 If you do not have an existing application, you can clone an example application that demonstrates the Dockerfile workflow. 14 15 .. code-block:: console 16 17 $ git clone https://github.com/deis/helloworld.git 18 $ cd helloworld 19 20 Dockerfile Requirements 21 ^^^^^^^^^^^^^^^^^^^^^^^ 22 In order to deploy Dockerfile applications, they must conform to the following requirements: 23 24 * The Dockerfile must EXPOSE only one port 25 * The port must be listening for a HTTP connection 26 * A default CMD must be specified for running the container 27 * Bash should be available in the Docker image 28 29 .. note:: 30 31 Dockerfiles which expose more than one port will hit `issue 1156`_. 32 33 Create an Application 34 --------------------- 35 Use ``deis create`` to create an application on the :ref:`controller`. 36 37 .. code-block:: console 38 39 $ deis create 40 Creating application... done, created folksy-offshoot 41 Git remote deis added 42 43 Push to Deploy 44 -------------- 45 Use ``git push deis master`` to deploy your application. 46 47 .. code-block:: console 48 49 $ git push deis master 50 Counting objects: 13, done. 51 Delta compression using up to 8 threads. 52 Compressing objects: 100% (13/13), done. 53 Writing objects: 100% (13/13), 1.99 KiB | 0 bytes/s, done. 54 Total 13 (delta 2), reused 0 (delta 0) 55 -----> Building Docker image 56 Uploading context 4.096 kB 57 Uploading context 58 Step 0 : FROM deis/base:latest 59 ---> 60024338bc63 60 Step 1 : RUN wget -O /tmp/go1.2.1.linux-amd64.tar.gz -q https://go.googlecode.com/files/go1.2.1.linux-amd64.tar.gz 61 ---> Using cache 62 ---> cf9ef8c5caa7 63 Step 2 : RUN tar -C /usr/local -xzf /tmp/go1.2.1.linux-amd64.tar.gz 64 ---> Using cache 65 ---> 515b1faf3bd8 66 Step 3 : RUN mkdir -p /go 67 ---> Using cache 68 ---> ebf4927a00e9 69 Step 4 : ENV GOPATH /go 70 ---> Using cache 71 ---> c6a276eded37 72 Step 5 : ENV PATH /usr/local/go/bin:/go/bin:$PATH 73 ---> Using cache 74 ---> 2ba6f6c9f108 75 Step 6 : ADD . /go/src/github.com/deis/helloworld 76 ---> 94ab7f4b977b 77 Removing intermediate container 171b7d9fdb34 78 Step 7 : RUN cd /go/src/github.com/deis/helloworld && go install -v . 79 ---> Running in 0c8fbb2d2812 80 github.com/deis/helloworld 81 ---> 13b5af931393 82 Removing intermediate container 0c8fbb2d2812 83 Step 8 : ENV PORT 80 84 ---> Running in 9b07da36a272 85 ---> 2dce83167874 86 Removing intermediate container 9b07da36a272 87 Step 9 : CMD ["/go/bin/helloworld"] 88 ---> Running in f7b215199940 89 ---> b1e55ce5195a 90 Removing intermediate container f7b215199940 91 Step 10 : EXPOSE 80 92 ---> Running in 7eb8ec45dcb0 93 ---> ea1a8cc93ca3 94 Removing intermediate container 7eb8ec45dcb0 95 Successfully built ea1a8cc93ca3 96 -----> Pushing image to private registry 97 98 Launching... done, v2 99 100 -----> folksy-offshoot deployed to Deis 101 http://folksy-offshoot.local3.deisapp.com 102 103 To learn more, use `deis help` or visit http://deis.io 104 105 To ssh://git@local3.deisapp.com:2222/folksy-offshoot.git 106 * [new branch] master -> master 107 108 $ curl -s http://folksy-offshoot.local3.deisapp.com 109 Welcome to Deis! 110 See the documentation at http://docs.deis.io/ for more information. 111 112 Because a Dockerfile application is detected, the ``cmd`` process type is automatically scaled to 1 on first deploy. 113 114 Use ``deis scale cmd=3`` to increase ``cmd`` processes to 3, for example. Scaling a 115 process type directly changes the number of :ref:`Containers <container>` 116 running that process. 117 118 119 .. _`Dockerfile`: https://docs.docker.com/reference/builder/ 120 .. _`Docker Image`: https://docs.docker.com/introduction/understanding-docker/ 121 .. _`CMD instruction`: https://docs.docker.com/reference/builder/#cmd 122 .. _`issue 1156`: https://github.com/deis/deis/issues/1156 123 .. _`Procfile`: https://devcenter.heroku.com/articles/procfile