Skip to content

Commit 0a72894

Browse files
committed
Make Docker upper case and add bash labels
1 parent 90b5918 commit 0a72894

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tutorials/cp-cf-understand-docker-application-lifecycle/cp-cf-understand-docker-application-lifecycle.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ When you push an application to Cloud Foundry (`cf push`), it uses a [buildpack]
3131

3232
2. Access to the registry is also required when the application needs to be re-staged or restarted. If the registry is not accessible, these operations will fail. For this reason it is required to re-push your application if the credentials for a private container registry change.
3333

34-
3. Additionally, when you use a buildpack, your main concern is your application code. The buildpack takes care of the work of downloading dependencies, compiling code, and creating a droplet from which your application can run. However, when using a docker image, you have to do all this yourself (set up the image, define dependencies, provide settings the image/app needs to start, etc.)
34+
3. Additionally, when you use a buildpack, your main concern is your application code. The buildpack takes care of the work of downloading dependencies, compiling code, and creating a droplet from which your application can run. However, when using a Docker image, you have to do all this yourself (set up the image, define dependencies, provide settings the image/app needs to start, etc.)
3535

3636
4. Related to the above, buildpacks are generally maintained and updated by the Cloud Foundry community, but this is not the case for referenced Docker base images. Here you will need to keep track of security vulnerabilities and update the base images. If a base image is not maintained any more you will need to maintain your own base images. Moral of the story: don't take on more than you absolutely have to, but be certain you trust the source of all your base images and buildpacks.
3737

@@ -41,7 +41,7 @@ When you push an application to Cloud Foundry (`cf push`), it uses a [buildpack]
4141

4242
[ACCORDION-BEGIN [Step 2 ](Push a Docker based application)]
4343

44-
To see how docker based applications work you will take the [cf-nodejs](https://github.com/SAP-archive/cf-sample-app-nodejs) application you deployed before and create a docker image of it, which you will then deploy. To do this, the first thing you need to do is create a `Dockerfile` in the same directory as your application files. The path to the `Dockerfile` should be `<path-to-cf-sample-app-nodejs>/Dockerfile` Once the file is created, open the `Dockerfile` with your favorite editor, and add the following (lines beginning with `#` are comments explaining what the line below it does):
44+
To see how Docker based applications work you will take the [cf-nodejs](https://github.com/SAP-archive/cf-sample-app-nodejs) application you deployed before and create a Docker image of it, which you will then deploy. To do this, the first thing you need to do is create a `Dockerfile` in the same directory as your application files. The path to the `Dockerfile` should be `<path-to-cf-sample-app-nodejs>/Dockerfile` Once the file is created, open the `Dockerfile` with your favorite editor, and add the following (lines beginning with `#` are comments explaining what the line below it does):
4545

4646
```
4747
# specify the node base image with your desired version node:<version>
@@ -58,9 +58,9 @@ COPY . .
5858
CMD [ "node", "server.js" ]
5959
```
6060

61-
In the above code we begin with the official Node image from Docker. We then proceed to add onto this base image, adding files, downloading dependencies, and providing the start command for the `cf-nodejs` app. Make sure to save the file once you have added the code above. Once that is done you then need to tell Docker to build your image. Run the following command (the `username` is your `Dockerhub` username and some commands may require you to enter your `Dockerhub` password):
61+
The code above begins with the official Node image from Docker. We then proceed to add onto this base image, adding files, downloading dependencies, and providing the start command for the `cf-nodejs` app. Make sure to save the file once you have added the code above. Once that is done you then need to tell Docker to build your image. Run the following command (the `username` is your `Dockerhub` username and some commands may require you to enter your `Dockerhub` password):
6262

63-
```
63+
```Bash
6464
cd <path-to-cf-sample-app-nodejs>
6565
docker build -t <username>/cf-nodejs-app .
6666
```
@@ -71,7 +71,7 @@ You should see output similar to the following:
7171

7272
Now that the image is built, you need to push it to a repository on `Dockerhub`. Running the following commands, a repository will be created for your user called `cf-nodejs-app` and your image will be uploaded to it:
7373

74-
```
74+
```Bash
7575
docker login -u <docker-id>
7676
docker push <username>/cf-nodejs-app
7777
```
@@ -80,19 +80,19 @@ docker push <username>/cf-nodejs-app
8080

8181
Finally, once the image has been uploaded, you can push the image to Cloud Foundry (you can replace the name `docker-nodejs` with whatever you want to name your application).
8282

83-
```
83+
```Bash
8484
cf push docker-nodejs --docker-image <username>/cf-nodejs-app:latest --docker-username <username>
8585
```
8686

8787
> In this example `cf-nodejs-app:latest` is used, but in the next section you will see why using the 'latest' image may not always be what you want.
8888
8989
Finally, once the application has started you should be able to access the app through a browser and see the same output as when you ran the `cf-nodejs` app using a buildpack. You can also validate that your application is actually using the docker image by running:
9090

91-
```
91+
```Bash
9292
cf app docker-nodejs
9393
```
9494

95-
You should then see the `docker image` field with the name your docker image next to it, similar to the output below.
95+
You should then see the `docker image` field with the name your Docker image next to it, similar to the output below.
9696

9797
!![Link text e.g., Destination screen](docker-image.png)
9898

0 commit comments

Comments
 (0)