fixing some additional formatting blips

Signed-off-by: LRubin <lrubin@docker.com>
This commit is contained in:
LRubin 2016-12-12 11:55:18 -08:00
parent 74cbb5e33a
commit b817088c57
9 changed files with 77 additions and 45 deletions

View File

@ -7,7 +7,8 @@ redirect_from:
title: Provision a data backend for your service
---
Docker Cloud offers a large number of data stores in the *Jumpstart* library, including Redis, MongoDB, PostgreSQL, and MySQL.
Docker Cloud offers a large number of data stores in the *Jumpstart* library,
including Redis, MongoDB, PostgreSQL, and MySQL.
You may have noticed that your app has a visit counter that's been disabled up
until now. In this step you'll add a data backend that your service will use. In
@ -18,7 +19,7 @@ The first step is to provision the data service itself. Run this command to
create and run the Redis service using the <a href="https://github.com/docker-library/redis/" target ="_blank">redis</a>
image:
```
```none
$ docker-cloud service run \
--env REDIS_PASS="password" \
--name redis \
@ -28,7 +29,7 @@ redis
Use `docker-cloud service ps` to check if your new redis service is *running*. This might take a minute or two.
```
```none
$ docker-cloud service ps
NAME UUID STATUS IMAGE DEPLOYED
redis 89806f93 ▶ Running redis:latest 29 minutes ago
@ -50,7 +51,7 @@ Next, visit or `curl` the load balanced web endpoint again. You'll notice that t
If you're using curl, you should see the counter incrementing like this:
```
```none
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io
Hello World</br>Hostname: web-1</br>Counter: 1%
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io
@ -63,4 +64,4 @@ $ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io
Hello World</br>Hostname: web-3</br>Counter: 5%
```
Next, we'll look at [Stackfiles for your service](11_service_stacks.md)
Next, we'll look at [Stackfiles for your service](11_service_stacks.md)

View File

@ -28,7 +28,7 @@ $ docker-cloud service redeploy redis
Check the container status using the `container ps` command, and wait until the new container is running again. In the example below you can see the original container in the "Terminated" state, and the new container that is "Starting".
```
```none
$ docker-cloud container ps --service redis
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
redis-1 5ddc0d66 ✘ Terminated redis:staging /run.sh 0 15 minutes ago 6379/tcp
@ -37,7 +37,7 @@ redis-1 3eff67a9 ⚙ Starting redis:staging /run.sh
Once the container is running, get the web endpoint using `container ps`, then try curling or visiting the web endpoint again
```
```none
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io:80
<h3>Hello Friendly Users!</h3><b>Hostname:</b> web-1<br/><b>Visits:</b> 1%
```
@ -46,11 +46,14 @@ The Redis cache service redeployment caused the counter to reset.
#### Enabling persistence
The specific Redis image (*redis*) in this tutorial supports data persistence. This is not a common requirement for a Redis cache and it's not enabled by default in most images. However to activate this in *our* image, you only need to set two environment variables.
The specific Redis image (*redis*) in this tutorial supports data persistence.
This is not a common requirement for a Redis cache and it's not enabled by
default in most images. However to activate this in *our* image, you only need
to set two environment variables.
Run the following command to create and set these two environment variables.
```
```none
$ docker-cloud service set \
-e REDIS_APPENDONLY=yes \
-e REDIS_APPENDFSYNC=always \
@ -63,11 +66,13 @@ open source `redis` image <a href="https://github.com/docker-library/redis/" tar
With these settings, Redis can create and store its data in a volume. The volume is in `/data`.
Visit the web endpoint a few more times to make sure that the cache is working as expected. Then redeploy the Redis service to see if the counter resets, or if it persists even after the container is terminated and re-created.
Visit the web endpoint a few more times to make sure that the cache is working
as expected. Then redeploy the Redis service to see if the counter resets, or if
it persists even after the container is terminated and re-created.
Curl the service to increment the counter:
```
```none
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io:80
<h3>Hello Python users!!</h3><b>Hostname:</b> web-1<br/><b>Visits:</b> 1%
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io:80
@ -78,13 +83,13 @@ $ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io:80
Next, redeploy the service using the `service redeploy` command:
```
```none
$ docker-cloud service redeploy redis
```
Check the service status:
```
```none
$ docker-cloud container ps --service redis
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
cache-1 8193cc1b ✘ Terminated redis:staging /run.sh 0 10 minutes ago 6379/tcp
@ -93,7 +98,7 @@ cache-1 61f63d97 ▶ Running redis:staging /run.sh
Once the service is running again, curl the web page again to see what the counter value is.
```
```none
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io:80
<h3>Hello Python users!!</h3><b>Hostname:</b> web-3<br/><b>Visits:</b> 4%
```
@ -134,4 +139,4 @@ set up a volume to save the data.
There's lots more to learn about Docker Cloud, so check out [the rest of our documentation](/docker-cloud/), the [API and CLI Documentation](../../../apidocs/docker-cloud.md), and our [Knowledge Hub](https://success.docker.com/Cloud) and [Docker Cloud Forums](https://forums.docker.com/c/docker-cloud).
Happy Docking!
Happy Docking!

View File

@ -7,8 +7,8 @@ redirect_from:
title: Introduction to deploying an app in Docker Cloud
---
In this tutorial you will bring an application to Docker Cloud using either Go or
Python. This tutorial is intended for more advanced beginners who have some
In this tutorial you will bring an application to Docker Cloud using either Go
or Python. This tutorial is intended for more advanced beginners who have some
experience with web applications, and who want to learn more about
multi-container services in Docker Cloud.
@ -20,4 +20,4 @@ This tutorial assumes that you have:
Let's get started!
[Set up your environment](2_set_up.md).
[Set up your environment](2_set_up.md).

View File

@ -16,11 +16,13 @@ In step 2, you set your Docker Cloud username as an environment variable called
First tag the image. Tags in this case denote different builds of an image.
**Python quickstart**
```bash
$ docker tag quickstart-python $DOCKER_ID_USER/quickstart-python
```
**Go quickstart**
```bash
$ docker tag quickstart-go $DOCKER_ID_USER/quickstart-go
```
@ -28,11 +30,13 @@ $ docker tag quickstart-go $DOCKER_ID_USER/quickstart-go
Next, push the tagged image to the repository.
**Python quickstart**
```
$ docker push $DOCKER_ID_USER/quickstart-python
```
**Go quickstart**
```
$ docker push $DOCKER_ID_USER/quickstart-go
```

View File

@ -9,12 +9,14 @@ title: Deploy the app as a Docker Cloud service
In this step you will deploy the app as a Docker Cloud Service. Remember that a service is a group of containers of the same **image:tag**.
What you'll do in this step is slightly different if you have Docker Engine installed locally or not.
If you have Docker Engine installed locally, start at [Deploy app with Docker Engine installed locally](5_deploy_the_app_as_a_service.md#deploy-app-with-docker-engine-installed-locally).
What you'll do in this step is slightly different if you have Docker Engine
installed locally or not.
If you do not have Docker Engine installed locally, start at [Deploy app without Docker Engine installed locally](5_deploy_the_app_as_a_service.md#deploy-app-without-docker-engine-installed-locally).
* If you have Docker Engine installed locally, start at
[Deploy app with Docker Engine installed locally](5_deploy_the_app_as_a_service.md#deploy-app-with-docker-engine-installed-locally).
* If you do not have Docker Engine installed locally, start at [Deploy app without Docker Engine installed locally](5_deploy_the_app_as_a_service.md#deploy-app-without-docker-engine-installed-locally).
> **Note**: If you don't have Docker Engine installed locally, skip to
## Deploy app with Docker Engine installed locally
@ -29,42 +31,53 @@ or
```bash
$ docker-cloud service run -p 80 --name web $DOCKER_ID_USER/quickstart-go
```
Skip the next section and read about [The run command](5_deploy_the_app_as_a_service.md#the-run-command).
## Deploy app without Docker Engine installed locally
If you don't have Docker Engine installed locally and you have been following this tutorial, you probably don't have either of the quickstart images in your private registry in Docker Cloud. To deploy the service without Engine installed locally, use the public images `dockercloud/quickstart-python` or `dockercloud/quickstart-go` available on Docker Hub.
If you don't have Docker Engine installed locally and you have been following
this tutorial, you probably don't have either of the quickstart images in your
private registry in Docker Cloud. To deploy the service without Engine installed
locally, use the public images `dockercloud/quickstart-python` or
`dockercloud/quickstart-go` available on Docker Hub.
To do this execute one of the following commands:
**Python quickstart**
```bash
$ docker-cloud service run -p 80 --name web dockercloud/quickstart-python
```
**Go quickstart**
```bash
$ docker-cloud service run -p 80 --name web dockercloud/quickstart-go
```
Go to the next section to read about [The run command](5_deploy_the_app_as_a_service.md#the-run-command).
## The run command
The `run` command **creates and runs** the service using the image you chose. The **-p 80** flag publishes port 80 in the container so that it is publicly accessible, and maps it to a dynamically assigned port in the node.
It might take a minute or two to get your service up and running. Once it completes the startup process, it will be in the *running* state.
It might take a minute or two to get your service up and running. Once it
completes the startup process, it will be in the *running* state.
To check the status of your service from the CLI use the `docker-cloud service ps` command.
```
```none
$ docker-cloud service ps
NAME UUID STATUS IMAGE DEPLOYED
web 68a6fb2c ▶ Running my-username/quickstart-python:latest 1 hour ago
```
Make sure that the **STATUS** for your service is **Running**. Next, visit the app at the URL generated by its service name. Find this URL by running `docker-cloud container ps`.
Make sure that the **STATUS** for your service is **Running**. Next, visit the
app at the URL generated by its service name. Find this URL by running
`docker-cloud container ps`.
```
```none
$ docker-cloud container ps
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
web-1 6c89f20e ▶ Running my-username/quickstart-python:latest python app.py 1 minute ago web-1.my-username.cont.dockerapp.io:49162->80/tcp
@ -84,4 +97,4 @@ Hello World!</br>Hostname: web-1</br>Counter: Redis Cache not found, counter dis
**CONGRATULATIONS!** You've deployed your first service using Docker Cloud.
Next: [Define environment variables](6_define_environment_variables.md).
Next: [Define environment variables](6_define_environment_variables.md).

View File

@ -40,9 +40,12 @@ $ docker-cloud service set --env NAME="Friendly Users" --redeploy web
## Check endpoint status
Execute `docker-cloud container ps` again to see the container's new endpoint. You should now see two `web-1` containers, one with a status of **terminated** (that's the original container) and another one either **starting** or already **running**.
Execute `docker-cloud container ps` again to see the container's new endpoint.
You should now see two `web-1` containers, one with a status of **terminated**
(that's the original container) and another one either **starting** or already
**running**.
```
```none
$ docker-cloud container ps
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
web-1 a2ff2247 ✘ Terminated my-username/quickstart-python:latest python app.py 40 minutes ago web-1.my-username.cont.dockerapp.io:49165->80/tcp
@ -53,7 +56,7 @@ Now curl the new endpoint to see the updated greeting.
> **Note**: If `docker-cloud container ps` doesn't show an endpoint for the container yet, wait until the container status changes to **running**.
```
```none
$ curl web-1.$DOCKER_ID_USER.cont.dockerapp.io:49162
Hello Friendly Users!</br>Hostname: e360d05cdb81</br>Counter: Redis Cache not found, counter disabled.%
```
@ -62,13 +65,15 @@ Your service now returns `Hello Friendly Users!`. Great! You've modified your se
### Environment Variables and the Dockerfile
Environment variables can also be set in the Dockerfile, and modified at runtime (like you just did).
Environment variables can also be set in the Dockerfile, and modified at runtime
(like you just did).
Wondering where the default value for the **NAME** environment variable is set? Look in the quickstart's Dockerfile.
Wondering where the default value for the **NAME** environment variable is set?
Look in the quickstart's Dockerfile.
```
```none
# Environment Variables
ENV NAME World
```
Next, we'll try [Scaling the service](7_scale_the_service.md).
Next, we'll try [Scaling the service](7_scale_the_service.md).

View File

@ -11,7 +11,7 @@ Right now, your service is running on a single container. That's great for now.
You can check how many containers are running using the `docker-cloud container ps` command.
```
```none
$ docker-cloud container ps
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
web-1 6c89f20e ▶ Running my-username/python-quickstart:latest python app.py 1 hour ago web-1.my-username.cont.dockerapp.io:49162->80/tcp
@ -27,7 +27,7 @@ In this example, you can see we're scaling the service called `web` to `2` conta
Run `service ps` again, and you should see now see your service scaling:
```
```none
$ docker-cloud service ps
NAME UUID STATUS IMAGE DEPLOYED
web 68a6fb2c ⚙ Scaling my-username/python-quickstart:latest 1 hour ago
@ -35,7 +35,7 @@ web 68a6fb2c ⚙ Scaling my-username/python-quickstart:latest
If you run `container ps` you should see multiple containers:
```
```none
$ docker-cloud container ps
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
web-1 6c89f20e ▶ Running my-username/python-quickstart:latest python app.py 1 hour ago web-1.my-username.cont.dockerapp.io:49162->80/tcp
@ -44,7 +44,7 @@ web-2 ab045c42 ⚙ Starting my-username/python-quickstart:lat
Containers aren't assigned a *PORT* until they are *running*, so you have to wait until the Service status goes from *Scaling* to *Running* to see what port is assigned to them.
```
```none
$ docker-cloud container ps
NAME UUID STATUS IMAGE RUN COMMAND EXIT CODE DEPLOYED PORTS
web-1 6c89f20e ▶ Running my-username/python-quickstart:latest python app.py 1 hour ago web-1.my-username.cont.dockerapp.io:49162->80/tcp
@ -57,7 +57,7 @@ In the example output above, the URL `web-1.my-username.cont.dockerapp.io:49162`
If you use curl to visit the pages, you should see something like this:
```
```none
$ curl web-1.$DOCKER_ID_USER.cont.dockerapp.io:49166
Hello Python Users!</br>Hostname: web-1</br>Counter: Redis Cache not found, counter disabled.%
$ curl web-2.$DOCKER_ID_USER.cont.dockerapp.io:49156

View File

@ -14,7 +14,7 @@ service logs` command with the name of the service.
If we run `docker-cloud service logs web`, you'll see logs for both *web-1* and *web-2*, like the example below.
```
```none
$ docker-cloud service logs web
[web-1] 2015-01-13T22:45:37.250431077Z * Running on http://0.0.0.0:80/
[web-1] 2015-01-07T17:20:19.076174813Z 83.50.33.64 - - [07/Jan/2015 17:20:19] "GET / HTTP/1.1" 200 -
@ -26,7 +26,7 @@ $ docker-cloud service logs web
To see a specific container's logs, use the `container logs` and the specific container's name. To learn more about service and container hostnames, see [Service Discovery](../../apps/service-links.md#using-service-and-container-names-as-hostnames).
```
```none
$ docker-cloud container logs web-1
2015-01-07T17:18:24.550419508Z * Running on http://0.0.0.0:80/
2015-01-07T17:20:19.076174813Z 83.50.33.64 - - [07/Jan/2015 17:20:19] "GET / HTTP/1.1" 200 -
@ -36,4 +36,4 @@ $ docker-cloud container logs web-1
Visit your application using curl or your browser again. Run the `service logs web` command again, and you will see another log message for your visit.
Next, let's explore how to [Load balance the service](9_load-balance_the_service.md).
Next, let's explore how to [Load balance the service](9_load-balance_the_service.md).

View File

@ -58,9 +58,13 @@ web-2 ab045c42 ▶ Running my-username/quickstart-python:late
lb-1 9793e58b ▶ Running dockercloud/haproxy:latest /run.sh 14 minutes ago 443/tcp, lb-1.my-username.cont.dockerapp.io:80->80/tcp
```
You should notice an URL endpoint in the *PORT* column for haproxy-1. In the example above this is `lb-1.my-username.cont.dockerapp.io:80`. Open the `lb-1` URL in your browser or curl from the CLI.
You should notice an URL endpoint in the *PORT* column for haproxy-1. In the
example above this is `lb-1.my-username.cont.dockerapp.io:80`. Open the `lb-1`
URL in your browser or curl from the CLI.
If you refresh or run curl multiple times you should see requests distributed between the two containers of in the `web` service. You can see which container responds to your request in the `Hostname` section of the response.
If you refresh or run curl multiple times you should see requests distributed
between the two containers of in the `web` service. You can see which container
responds to your request in the `Hostname` section of the response.
```none
$ curl lb-1.$DOCKER_ID_USER.cont.dockerapp.io