Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Ogala/labs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: docker/labs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 369 additions and 480 deletions.
  1. +1 −45 .github/ISSUE_TEMPLATE
  2. +3 −0 README.md
  3. +2 −2 beginner/chapters/votingapp.md
  4. +48 −33 beginner/chapters/webapps.md
  5. +1 −1 beginner/flask-app/requirements.txt
  6. +1 −1 contribute.md
  7. +83 −71 developer-tools/java-debugging/app/pom.xml
  8. +1 −1 developer-tools/java-debugging/docker-compose.yml
  9. +2 −2 developer-tools/java-debugging/registration-database/Dockerfile
  10. +1 −1 developer-tools/java/chapters/ch01-setup.adoc
  11. +1 −1 developer-tools/java/chapters/ch10-monitoring.adoc
  12. +4 −4 developer-tools/nodejs-debugging/app/package-lock.json
  13. +1 −1 developer-tools/ruby/README.md
  14. +2 −2 dockercon-us-2017/README.md
  15. +1 −1 dockercon-us-2017/docker-cloud/README.md
  16. +2 −2 dockercon-us-2017/docker-enterprise/README.md
  17. +1 −1 dockercon-us-2017/securing-apps-docker-enterprise/README.md
  18. +1 −1 ...ercon-us-2017/windows-modernize-aspnet-dev/v1-src/ProductLaunch/ProductLaunch.Web/packages.config
  19. +1 −1 security/apparmor/README.md
  20. +2 −2 security/apparmor/wordpress/zues/zues-framework/libraries/customizer/README.md
  21. +1 −1 security/capabilities/README.md
  22. +4 −4 security/cgroups/README.md
  23. +1 −1 security/scanning/README.md
  24. +2 −2 security/trust/README.md
  25. +1 −1 windows/readme.md
  26. +2 −15 windows/sql-server/Dockerfile.builder
  27. +21 −6 windows/sql-server/Dockerfile.v1
  28. +21 −6 windows/sql-server/Dockerfile.v2
  29. +55 −36 windows/sql-server/Initialize-Database.ps1
  30. +12 −10 windows/sql-server/part-3.md
  31. +2 −2 windows/sql-server/part-4.md
  32. +23 −36 windows/windows-containers/MultiContainerApp.md
  33. +52 −8 windows/windows-containers/README.md
  34. +0 −27 windows/windows-containers/Setup-AWS.md
  35. +0 −30 windows/windows-containers/Setup-Azure.md
  36. +0 −55 windows/windows-containers/Setup-Server2016.md
  37. +0 −18 windows/windows-containers/Setup-Win10.md
  38. +0 −13 windows/windows-containers/Setup.md
  39. +13 −36 windows/windows-containers/WindowsContainers.md
46 changes: 1 addition & 45 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,45 +1 @@
** PLEASE ONLY USE THIS ISSUE TRACKER TO SUBMIT ISSUES WITH THE DOCKER LABS TUTORIAL CONTENT **

* If you have a bug working with Docker itself, not related to these labs, please file the bug on the [Docker repo](https://github.com/moby/moby) *
* If you would like general support figuring out how to do something with Docker, please use the Docker Slack channel. If you're not on that channel, sign up for the [Docker Community](http://dockr.ly/MeetUp) and you'll get an invite. *
* Or go to the [Docker Forums](https://forums.docker.com/) *

Please provide the following information so we can assess the issue you're having

**Which lab is it that you're having issues with?**

<!--
Title or URL of the lab
-->
**Description**

<!--
Briefly describe the problem you are having in a few paragraphs.
-->

**Steps to reproduce the issue, if relevant:**
1.
2.
3.

**Describe the results you received:**


**Describe the results you expected:**


**Additional information you deem important (e.g. issue happens only occasionally):**

**Output of `docker version`:**

```
(paste your output here)
```

**Output of `docker info`:**

```
(paste your output here)
```

**Additional environment details (AWS, Docker for Mac, Docker for Windows, VirtualBox, physical, etc.):**
At this time we are not actively adding labs to this repository. Our focus is on training.play-with-docker.com where new lab and workshop oriented content is being added. We welcome fixes to existing content. For any new content you wish to contribute, please use this repository:https://github.com/play-with-docker/play-with-docker.github.io. Issues filed against the repo may or may not be fixed.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Docker Tutorials and Labs

> At this time we are not actively adding labs to this repository. Our focus is on [training.play-with-docker.com](https://training.play-with-docker.com) where new lab and workshop oriented content is being added. We welcome fixes to existing content. For any new content you wish to contribute, please use this repository:[https://github.com/play-with-docker/play-with-docker.github.io](https://github.com/play-with-docker/play-with-docker.github.io).

This repo contains [Docker](https://docker.com) labs and tutorials authored both by Docker, and by members of the community. We welcome contributions and want to grow the repo.

#### Docker tutorials:
4 changes: 2 additions & 2 deletions beginner/chapters/votingapp.md
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ Take a look at the file again. You'll see it starts with
```
version: "3"
```
It's important that you use version 3 of compose files, as `docker stack deploy` won't support use of earlier versions. You will see there's also a `services` key, under which there is a separate key for each of the services. Such as:
It's important that you use [version 3](https://docs.docker.com/compose/compose-file/) of compose files, as `docker stack deploy` won't support use of earlier versions. You will see there's also a `services` key, under which there is a separate key for each of the services. Such as:
```
vote:
image: dockersamples/examplevotingapp_vote:before
@@ -186,7 +186,7 @@ The `image` key there specifies which image you can use, in this case the image

Much like `docker run` you will see you can define `ports` and `networks`. There's also a `depends_on` key which allows you to specify that a service is only deployed after another service, in this case `vote` only deploys after `redis`.

The `deploy` key is new in version 3. It allows you to specify various properties of the deployment to the Swarm. In this case, you are specifying that you want two replicas, that is two containers are deployed on the Swarm. You can specify other properties, like when to restart, what [healthcheck](https://docs.docker.com/engine/reference/builder/#healthcheck) to use, placement constraints, resources.
The [`deploy`](https://docs.docker.com/compose/compose-file/#deploy) key is new in version 3. It allows you to specify various properties of the deployment to the Swarm. In this case, you are specifying that you want two replicas, that is two containers are deployed on the Swarm. You can specify other properties, like when to restart, what [healthcheck](https://docs.docker.com/engine/reference/builder/#healthcheck) to use, placement constraints, resources, etc.

#### Test run

81 changes: 48 additions & 33 deletions beginner/chapters/webapps.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ Let's start by taking baby-steps. First, we'll use Docker to run a static websit

The image that you are going to use is a single-page website that was already created for this demo and is available on the Docker Store as [`dockersamples/static-site`](https://store.docker.com/community/images/dockersamples/static-site). You can download and run the image directly in one go using `docker run` as follows.

```
```bash
$ docker run -d dockersamples/static-site
```

@@ -28,14 +28,15 @@ First, stop the container that you have just launched. In order to do this, we n

Since we ran the container in detached mode, we don't have to launch another terminal to do this. Run `docker ps` to view the running containers.

```
```bash
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7a0e504ca3e dockersamples/static-site "/bin/sh -c 'cd /usr/" 28 seconds ago Up 26 seconds 80/tcp, 443/tcp stupefied_mahavira
```

Check out the `CONTAINER ID` column. You will need to use this `CONTAINER ID` value, a long sequence of characters, to identify the container you want to stop, and then to remove it. The example below provides the `CONTAINER ID` on our system; you should use the value that you see in your terminal.
```

```bash
$ docker stop a7a0e504ca3e
$ docker rm a7a0e504ca3e
```
@@ -44,7 +45,7 @@ $ docker rm a7a0e504ca3e
Now, let's launch a container in **detached** mode as shown below:

```
```bash
$ docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
e61d12292d69556eabe2a44c16cbd54486b2527e2ce4f95438e504afb7b02810
```
@@ -59,7 +60,7 @@ In the above command:

Now you can see the ports by running the `docker port` command.

```
```bash
$ docker port static-site
443/tcp -> 0.0.0.0:32772
80/tcp -> 0.0.0.0:32773
@@ -69,17 +70,18 @@ If you are running [Docker for Mac](https://docs.docker.com/docker-for-mac/), [D

If you are using Docker Machine on Mac or Windows, you can find the hostname on the command line using `docker-machine` as follows (assuming you are using the `default` machine).

```
```bash
$ docker-machine ip default
192.168.99.100
```
You can now open `http://<YOUR_IPADDRESS>:[YOUR_PORT_FOR 80/tcp]` to see your site live! For our example, this is: `http://192.168.99.100:32773`.

You can also run a second webserver at the same time, specifying a custom host port mapping to the container's webserver.

```
```bash
$ docker run --name static-site-2 -e AUTHOR="Your Name" -d -p 8888:80 dockersamples/static-site
```

<img src="../images/static.png" title="static">

To deploy this on a real server you would just need to install Docker, and run the above `docker` command(as in this case you can see the `AUTHOR` is Docker which we passed as an environment variable).
@@ -88,19 +90,20 @@ Now that you've seen how to run a webserver inside a Docker container, how do yo

But first, let's stop and remove the containers since you won't be using them anymore.

```
```bash
$ docker stop static-site
$ docker rm static-site
```

Let's use a shortcut to remove the second site:

```
```bash
$ docker rm -f static-site-2
```

Run `docker ps` to make sure the containers are gone.
```

```bash
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
```
@@ -111,7 +114,7 @@ In this section, let's dive deeper into what Docker images are. You will build y

Docker images are the basis of containers. In the previous example, you **pulled** the *dockersamples/static-site* image from the registry and asked the Docker client to run a container **based** on that image. To see the list of images that are available locally on your system, run the `docker images` command.

```
```bash
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
dockersamples/static-site latest 92a386b6e686 2 hours ago 190.5 MB
@@ -132,15 +135,15 @@ For simplicity, you can think of an image akin to a git repository - images can

For example you could pull a specific version of `ubuntu` image as follows:

```
```bash
$ docker pull ubuntu:12.04
```

If you do not specify the version number of the image then, as mentioned, the Docker client will default to a version named `latest`.

So for example, the `docker pull` command given below will pull an image named `ubuntu:latest`:

```
```bash
$ docker pull ubuntu
```

@@ -159,6 +162,7 @@ Another key concept is the idea of _official images_ and _user images_. (Both of
- **User images** are images created and shared by users like you. They build on base images and add additional functionality. Typically these are formatted as `user/image-name`. The `user` value in the image name is your Docker Store user or organization name.

### 2.3 Create your first image

>**Note:** The code for this section is in this repository in the [flask-app](https://github.com/docker/labs/tree/master/beginner/flask-app) directory.
Now that you have a better understanding of images, it's time to create your own. Our goal here is to create an image that sandboxes a small [Flask](http://flask.pocoo.org) application.
@@ -187,29 +191,30 @@ Start by creating a directory called ```flask-app``` where we'll create the foll
Make sure to ```cd flask-app``` before you start creating the files, because you don't want to start adding a whole bunch of other random files to your image.

#### app.py

Create the **app.py** with the following content:

```
```python
from flask import Flask, render_template
import random

app = Flask(__name__)

# list of cat images
images = [
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26388-1381844103-11.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr01/15/9/anigif_enhanced-buzz-31540-1381844535-8.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26390-1381844163-18.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/10/anigif_enhanced-buzz-1376-1381846217-0.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr03/15/9/anigif_enhanced-buzz-3391-1381844336-26.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/10/anigif_enhanced-buzz-29111-1381845968-0.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr03/15/9/anigif_enhanced-buzz-3409-1381844582-13.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr02/15/9/anigif_enhanced-buzz-19667-1381844937-10.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26358-1381845043-13.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/9/anigif_enhanced-buzz-18774-1381844645-6.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr06/15/9/anigif_enhanced-buzz-25158-1381844793-0.gif",
"http://ak-hdl.buzzfed.com/static/2013-10/enhanced/webdr03/15/10/anigif_enhanced-buzz-11980-1381846269-1.gif"
]
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26388-1381844103-11.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr01/15/9/anigif_enhanced-buzz-31540-1381844535-8.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26390-1381844163-18.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr06/15/10/anigif_enhanced-buzz-1376-1381846217-0.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr03/15/9/anigif_enhanced-buzz-3391-1381844336-26.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr06/15/10/anigif_enhanced-buzz-29111-1381845968-0.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr03/15/9/anigif_enhanced-buzz-3409-1381844582-13.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr02/15/9/anigif_enhanced-buzz-19667-1381844937-10.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr05/15/9/anigif_enhanced-buzz-26358-1381845043-13.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr06/15/9/anigif_enhanced-buzz-18774-1381844645-6.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr06/15/9/anigif_enhanced-buzz-25158-1381844793-0.gif",
"http://img.buzzfeed.com/buzzfeed-static/static/2013-10/enhanced/webdr03/15/10/anigif_enhanced-buzz-11980-1381846269-1.gif"
]

@app.route('/')
def index():
@@ -219,16 +224,20 @@ def index():
if __name__ == "__main__":
app.run(host="0.0.0.0")
```

#### requirements.txt

In order to install the Python modules required for our app, we need to create a file called **requirements.txt** and add the following line to that file:

```
Flask==0.10.1
```

#### templates/index.html

Create a directory called `templates` and create an **index.html** file in that directory with the following content in it:

```
```html
<html>
<head>
<style type="text/css">
@@ -257,7 +266,9 @@ Create a directory called `templates` and create an **index.html** file in that
</body>
</html>
```

### 2.3.2 Write a Dockerfile

We want to create a Docker image with this web app. As mentioned above, all user images are based on a _base image_. Since our application is written in Python, we will build our own Python image based on [Alpine](https://store.docker.com/images/alpine). We'll do that using a **Dockerfile**.

A [Dockerfile](https://docs.docker.com/engine/reference/builder/) is a text file that contains a list of commands that the Docker daemon calls while creating an image. The Dockerfile contains all the information that Docker needs to know to run the app &#8212; a base Docker image to run from, location of your project code, any dependencies it has, and what commands to run at start-up. It is a simple way to automate the image creation process. The best part is that the [commands](https://docs.docker.com/engine/reference/builder/) you write in a Dockerfile are *almost* identical to their equivalent Linux commands. This means you don't really have to learn new syntax to create your own Dockerfiles.
@@ -272,6 +283,7 @@ A [Dockerfile](https://docs.docker.com/engine/reference/builder/) is a text file
```

2. The next step usually is to write the commands of copying the files and installing the dependencies. But first we will install the Python pip package to the alpine linux distribution. This will not just install the pip package but any other dependencies too, which includes the python interpreter. Add the following [RUN](https://docs.docker.com/engine/reference/builder/#run) command next:

```
RUN apk add --update py2-pip
```
@@ -293,6 +305,7 @@ A [Dockerfile](https://docs.docker.com/engine/reference/builder/) is a text file
```

4. Specify the port number which needs to be exposed. Since our flask app is running on `5000` that's what we'll expose.

```
EXPOSE 5000
```
@@ -410,7 +423,7 @@ If you don't have the `alpine:3.5` image, the client will first pull the image a
### 2.3.4 Run your image
The next step in this section is to run the image and see if it actually works.

```
```bash
$ docker run -p 8888:5000 --name myfirstapp YOUR_USERNAME/myfirstapp
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
```
@@ -426,29 +439,30 @@ Now that you've created and tested your image, you can push it to [Docker Cloud]

First you have to login to your Docker Cloud account, to do that:

```
```bash
docker login
```

Enter `YOUR_USERNAME` and `password` when prompted.

Now all you have to do is:

```
```bash
docker push YOUR_USERNAME/myfirstapp
```

Now that you are done with this container, stop and remove it since you won't be using it again.

Open another terminal window and execute the following commands:

```
```bash
$ docker stop myfirstapp
$ docker rm myfirstapp
```

or

```
```bash
$ docker rm -f myfirstapp
```

@@ -463,6 +477,7 @@ Here's a quick summary of the few basic commands we used in our Dockerfile.
* `COPY` copies local files into the container.

* `CMD` defines the commands that will run on the Image at start-up. Unlike a `RUN`, this does not create a new layer for the Image, but simply runs the command. There can only be one `CMD` per a Dockerfile/Image. If you need to run multiple commands, the best way to do that is to have the `CMD` run a script. `CMD` requires that you tell it where to run the command, unlike `RUN`. So example `CMD` commands would be:

```
CMD ["python", "./app.py"]
2 changes: 1 addition & 1 deletion beginner/flask-app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Flask==0.10.1
Flask==1.0
2 changes: 1 addition & 1 deletion contribute.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ Thank you so much for your interest in contributing to [Docker](https://docker.c

Just a few quick things to be aware of before you get started.

We welcome issues and pull requests for either adding a new tutorial, or fixing a problem with an existing tutorial. This is a repository for tutorials that use Docker based projects as much as possible. So if there’s a Docker tool for what you’re describing, please use that.
We welcome issues and pull requests for fixing a problem with an existing tutorial. We are not accepting new tutorials. If you want to contribute new tutorials, please consider contributing to [training.play-with-docker.com](https://training.play-with-docker.com) in this repository: [https://github.com/play-with-docker/play-with-docker.github.io](https://github.com/play-with-docker/play-with-docker.github.io).

Anything you contribute will be under an Apache license. Docker will choose which tutorials to accept and reject, and will be able to take any tutorials here and put them in Docker documentation. Likewise, anything posted here may be forked by anyone on GitHub.

Loading