Skip to content

Commit

Permalink
Merge branch 'master' into fixes-on-previous-labs
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianenardon authored Apr 8, 2017
2 parents aabbff4 + 945ac68 commit 79a4536
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 87 deletions.
2 changes: 1 addition & 1 deletion 12factor/03_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In _config/connections.js_, we define the _mongo_ connection and use MONGO_URL e
module.exports.connections = {
mongo: {
adapter: 'sails-mongo',
url: process.env.MONGO_URL'
url: 'process.env.MONGO_URL'
}
};
```
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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:
* [Docker for beginners] (beginner/readme.md)
* [Docker for beginners](beginner/readme.md)
* [Docker Swarm Mode](swarm-mode/README.md)
* [Configuring developer tools and programming languages](developer-tools/README.md)
* Java
Expand All @@ -20,7 +20,7 @@ This repo contains [Docker](https://docker.com) labs and tutorials authored both

#### Community tutorials
* [Docker Tutorials from the Community](https://github.com/docker/community/tree/master/Docker-Meetup-Content) - links to a different repository
* [Advanced Docker orchestration workshop] (https://github.com/docker/labs/tree/master/Docker-Orchestration) - links to a different repository
* [Advanced Docker orchestration workshop](https://github.com/docker/labs/tree/master/Docker-Orchestration) - links to a different repository

For more information on Docker, see the Official [Docker documentation](https://docs.docker.com).

Expand Down
2 changes: 1 addition & 1 deletion beginner/chapters/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Getting all the tooling setup on your computer can be a daunting task, but getti

The *getting started* guide on Docker has detailed instructions for setting up Docker on [Mac](https://docs.docker.com/docker-for-mac/), [Linux](https://docs.docker.com/engine/installation/linux/) and [Windows](https://docs.docker.com/docker-for-windows/).

*If you're using Docker for Windows* make sure you have [shared your drive](https://docs.docker.com/docker-for-windows/#/shared-drives).
*If you're using Docker for Windows* make sure you have [shared your drive](https://docs.docker.com/docker-for-windows/#shared-drives).

*Important note* If you're using an older version of Windows or MacOS you may need to use [Docker Machine](https://docs.docker.com/machine/overview/) instead.

Expand Down
9 changes: 7 additions & 2 deletions beginner/chapters/votingapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ services:
depends_on:
- db
deploy:
replicas: 2
replicas: 1
update_config:
parallelism: 2
delay: 10s
Expand All @@ -103,6 +103,8 @@ services:
delay: 10s
max_attempts: 3
window: 120s
placement:
constraints: [node.role == manager]
visualizer:
image: manomarks/visualizer
Expand All @@ -111,6 +113,9 @@ services:
stop_grace_period: 1m30s
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
frontend:
Expand All @@ -133,7 +138,7 @@ Creating service vote_worker
Creating service vote_redis
Creating service vote_db
```
to verify your stack has deployed, use `docker stack services`
to verify your stack has deployed, use `docker stack services vote`
```
docker stack services vote
ID NAME MODE REPLICAS IMAGE
Expand Down
16 changes: 8 additions & 8 deletions beginner/chapters/webapps.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Great! So you have now looked at `docker run`, played with a Docker container an
Let's start by taking baby-steps. First, we'll use Docker to run a static website in a container. The website is based on an existing image. We'll pull a Docker image from Docker Hub, run the container, and see how easy it is to set up a web server.

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 Hub as [`seqvence/static-site`](https://hub.docker.com/r/seqvence/static-site/). You can download and run the image directly in one go using `docker run` as follows.
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 Hub as [`dockersamples/static-site`](https://hub.docker.com/r/dockersamples/static-site/). You can download and run the image directly in one go using `docker run` as follows.

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

>**Note:** The current version of this image doesn't run without the `-d` flag. The `-d` flag enables **detached mode**, which detaches the running container from the terminal/shell and returns your prompt after the container starts. We are debugging the problem with this image but for now, use `-d` even for this first example.
Expand All @@ -31,7 +31,7 @@ Since we ran the container in detached mode, we don't have to launch another ter
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7a0e504ca3e seqvence/static-site "/bin/sh -c 'cd /usr/" 28 seconds ago Up 26 seconds 80/tcp, 443/tcp stupefied_mahavira
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.
Expand All @@ -45,7 +45,7 @@ $ docker rm a7a0e504ca3e
Now, let's launch a container in **detached** mode as shown below:

```
$ docker run --name static-site -e AUTHOR="Your Name" -d -P seqvence/static-site
$ docker run --name static-site -e AUTHOR="Your Name" -d -P dockersamples/static-site
e61d12292d69556eabe2a44c16cbd54486b2527e2ce4f95438e504afb7b02810
```

Expand Down Expand Up @@ -78,7 +78,7 @@ You can now open `http://<YOUR_IPADDRESS>:[YOUR_PORT_FOR 80/tcp]` to see your si
You can also run a second webserver at the same time, specifying a custom host port mapping to the container's webserver.

```
$ docker run --name static-site-2 -e AUTHOR="Your Name" -d -p 8888:80 seqvence/static-site
$ docker run --name static-site-2 -e AUTHOR="Your Name" -d -p 8888:80 dockersamples/static-site
```
<img src="../images/static.png" title="static">

Expand All @@ -96,7 +96,7 @@ $ docker rm static-site
Let's use a shortcut to remove the second site:

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

Run `docker ps` to make sure the containers are gone.
Expand All @@ -109,12 +109,12 @@ CONTAINER ID IMAGE COMMAND CREATED

In this section, let's dive deeper into what Docker images are. You will build your own image, use that image to run an application locally, and finally, push some of your own images to Docker Hub.

Docker images are the basis of containers. In the previous example, you **pulled** the *seqvence/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.
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.

```
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
seqvence/static-site latest 92a386b6e686 2 hours ago 190.5 MB
dockersamples/static-site latest 92a386b6e686 2 hours ago 190.5 MB
nginx latest af4b3d7d5401 3 hours ago 190.5 MB
python 2.7 1c32174fd534 14 hours ago 676.8 MB
postgres 9.4 88d845ac7a88 14 hours ago 263.6 MB
Expand Down
21 changes: 18 additions & 3 deletions developer-tools/java-debugging/Eclipse-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,28 @@ Try to log into the application. Look at the value for password in the Eclipse v

In this MVC application the UserController uses the findByLogin method in the UserServiceImpl class which uses the findByUsername method to retrieve the information from the database. It then checks to see if the password from the form matches the user password. Since the password from the login form is not scrambled using ROT13, it does not match the user password and you cannot log into the application.

To fix this, apply ROT13 to the password by adding
To fix this, apply ROT13 to the password by adding an import near the top of the file

```
import com.docker.UserSignup.utit.Rot13
import com.docker.UserSignup.util.Rot13
```

and replace the contents of `findByLogin` with

String passwd = Rot13.rot13(password);
```
public boolean findByLogin(String userName, String password) {
User usr = userRepository.findByUserName(userName);
String passwd = Rot13.rot13(password);
if(usr != null && usr.getPassword().equals(passwd)) {
return true;
}
return false;
}
```

![](images/eclipse_debug_UserServiceImpl_code.png)

Set a breakpoint in UserServiceImpl on the findByLogin method. Log in again and look at the values for the breakpoint. The 'passwd' variable is `z0ol` which matches the password for the user moby.
Expand Down
25 changes: 10 additions & 15 deletions developer-tools/java/chapters/ch01-setup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@

This section describes the hardware and software needed for this workshop, and how to configure them. This workshop is designed for a BYOL (Brying Your Own Laptop) style hands-on-lab.

== Hardware
== Hardware & Software

. Operating System: Mac OS X (10.10+), Windows 10 Pro+, Ubuntu 12+, CentOS 7+
. Memory: At least 4 GB+, preferred 8 GB
. Memory: At least 4 GB+, strongly preferred 8 GB
. Operating System: Mac OS X (10.10.3+), Windows 10 Pro+ 64-bit, Ubuntu 12+, CentOS 7+.
+
NOTE: An older version of the operating system may be used. The installation instructions would differ slightly in that case and are explained in the next section.
. Amazon Web Services credentials with https://docs.docker.com/docker-for-aws/iam-permissions/[following permissions]. This is only needed for some parts of the workshop.

== Install Docker

Docker runs natively on Mac, Windows and Linux. Follow the instructions to install Docker:

. https://docs.docker.com/docker-for-mac/[Mac]
. https://docs.docker.com/docker-for-windows/[Windows]
. https://docs.docker.com/engine/installation/linux/centos/[Centos]
. https://docs.docker.com/engine/installation/linux/debian/[Debian]
. https://docs.docker.com/engine/installation/linux/ubuntulinux/[Ubuntu]

NOTE: Docker for Mac and Windows have requirements for a fairly recent operating system version. If your machine does not meet these requirements, then you need to install https://www.docker.com/products/docker-toolbox[Docker Toolbox].
Docker runs natively on Mac, Windows and Linux. This lab will use https://www.docker.com/community-edition[Docker Community Edition]. Follow the https://www.docker.com/community-edition[instructions] to install Docker.

Complete set of operating systems are listed at http://docs.docker.com/engine/installation/[Install Docker Engine].
NOTE: Docker Community Edition have requirements for a fairly recent operating system version. If your machine does not meet these requirements, then you need to install https://www.docker.com/products/docker-toolbox[Docker Toolbox].

=== Additional components

Expand All @@ -31,7 +26,7 @@ Install the following additional components:

=== Docker Toolbox Notes

Skip this section if you are not using Docker Toolbox for Mac or Windows.
Skip this section if you are using Docker Community Edition.

. *Default Docker Machine*: Docker Toolbox creates a Docker Machine named `default`. To make it easier to start/stop the containers, an entry is added into the host mapping table of your operating system.
+
Expand All @@ -44,7 +39,7 @@ docker-machine ip default
This will provide the IP address associated with the Docker Machine created by Toolbox.
+
Edit `/etc/hosts` (Mac OS) or `C:\Windows\System32\drivers\etc\hosts` (Windows) and add:

+
[source, text]
----
<IP ADDRESS> dockerhost
Expand Down
6 changes: 6 additions & 0 deletions developer-tools/java/chapters/ch03-build-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ This image uses `ubuntu` as the base image. `CMD` command defines the command th

Build the image using the command:

[source, text]
----
docker image build . -t helloworld
----

`.` in this command is the context for `docker image build`. `-t` adds a tag to the image.

The following output is shown:

[source, text]
----
Sending build context to Docker daemon 2.048 kB
Expand All @@ -67,6 +72,7 @@ Removing intermediate container 7615d69d04ec
Successfully built 61edf15e4cec
----


List the images available using `docker image ls`:

[source, text]
Expand Down
2 changes: 1 addition & 1 deletion developer-tools/java/chapters/ch04-run-container.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ If you want the container to accept incoming connections, you will need to provi

[source, text]
----
docker container stop `docker conatiner ps | grep wildfly | awk '{print $1}'`
docker container stop `docker container ps | grep wildfly | awk '{print $1}'`
----

Restart the container as:
Expand Down
2 changes: 1 addition & 1 deletion developer-tools/java/chapters/ch05-compose.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ In this Compose file:
. Image name for each service defined using `image` attribute
. The `arungupta/couchbase:travel` image starts Couchbase server, configures it using http://developer.couchbase.com/documentation/server/current/rest-api/rest-endpoints-all.html[Couchbase REST API], and loads a sample bucket
. The `arungupta/couchbase-javaee:travel` image starts WildFly and deploys application WAR file built from https://github.com/arun-gupta/couchbase-javaee. Clone that project if you want to build your own image.
. `envrionment` attribute defines environment variables accessible by the application deployed in WildFly. `COUCHBASE_URI` refers to the database service. This is used in the application code as shown at https://github.com/arun-gupta/couchbase-javaee/blob/master/src/main/java/org/couchbase/sample/javaee/Database.java.
. `environment` attribute defines environment variables accessible by the application deployed in WildFly. `COUCHBASE_URI` refers to the database service. This is used in the application code as shown at https://github.com/arun-gupta/couchbase-javaee/blob/master/src/main/java/org/couchbase/sample/javaee/Database.java.
. Port forwarding is achieved using `ports` attribute
. `depends_on` attribute allows to express dependency between services. In this case, Couchbase will be started before WildFly. Application-level health are still user's responsibility.

Expand Down
9 changes: 5 additions & 4 deletions developer-tools/java/chapters/ch10-monitoring.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,14 @@ https://github.com/google/cadvisor[cAdvisor] (Container Advisor) provides resour
. Run `cAdvisor`
+
```
docker run \
-d \
--name=cadvisor \
-p 8080:8080 \
docker container run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor:latest
```
+
Expand Down
1 change: 0 additions & 1 deletion developer-tools/nodejs/porting/2_application_image.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ WORKDIR /app
RUN npm install
# Expose API port to the outside
PORT 80
EXPOSE 80
# Launch application
Expand Down
2 changes: 1 addition & 1 deletion developer-tools/nodejs/porting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This tutorial starts with a simple Node.js application (HTTP Rest API built with [Sails.js](http://sailsjs.org/)) and details the steps needed to *Dockerize* it and ensure its scalability.

The application stores data in a MongoDB dabatase. This tutorial does not address the scaling of the MongoDB part.
The application stores data in a MongoDB database. This tutorial does not address the scaling of the MongoDB part.

Note: Do not hesitate to provide any comments / feedback you may have, that will help make this tutorial better.

Expand Down
2 changes: 1 addition & 1 deletion networking/A1-network-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ NETWORK ID NAME DRIVER SCOPE
ef4896538cc7 none null local
```

The output above shows the container networks that are created as part of a standard installation of Docker 1.12.
The output above shows the container networks that are created as part of a standard installation of Docker.

New networks that you create will also show up in the output of the `docker network ls` command.

Expand Down
8 changes: 4 additions & 4 deletions networking/concepts/06-overlay-networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

The built-in Docker `overlay` network driver radically simplifies many of the challenges in multi-host networking. With the `overlay` driver, multi-host networks are first-class citizens inside Docker without external provisioning or components. `overlay` uses the Swarm-distributed control plane to provide centralized management, stability, and security across very large scale clusters.

###VXLAN Data Plane
### VXLAN Data Plane
The `overlay` driver utilizes an industry-standard VXLAN data plane that decouples the container network from the underlying physical network (the _underlay_). The Docker overlay network encapsulates container traffic in a VXLAN header which allows the traffic to traverse the physical Layer 2 or Layer 3 network. The overlay makes network segmentation dynamic and easy to control no matter what the underlying physical topology. Use of the standard IETF VXLAN header promotes standard tooling to inspect and analyze network traffic.

> VXLAN has been a part of the Linux kernel since version 3.7, and Docker uses the native VXLAN features of the kernel to create overlay networks. The Docker overlay datapath is entirely in kernel space. This results in fewer context switches, less CPU overhead, and a low-latency, direct traffic path between applications and the physical NIC.
Expand All @@ -24,7 +24,7 @@ In this diagram we see the packet flow on an overlay network. Here are the steps



###Overlay Driver Internal Architecture
### Overlay Driver Internal Architecture
The Docker Swarm control plane automates all of the provisioning for an overlay network. No VXLAN configuration or Linux networking configuration is required. Data-plane encryption, an optional feature of overlays, is also automatically configured by the overlay driver as networks are created. The user or network operator only has to define the network (`docker network create -d overlay ...`) and attach containers to that network.

<span class="float-right">
Expand Down Expand Up @@ -89,6 +89,6 @@ Two interfaces have been created inside the container that correspond to two bri



> The Docker Overlay driver has existed since Docker Engine 1.9, and an external K/V store was required to manage state for the network. Docker Engine 1.12 integrated the control plane state into Docker Engine so that an external store is no longer required. 1.12 also introduced several new features including encryption and service load balancing. Networking features that are introduced require a Docker Engine version that supports them, and using these features with older versions of Docker Engine is not supported.
> The Docker Overlay driver has existed since Docker Engine 1.9, and an external K/V store was required to manage state for the network. Docker 1.12 integrated the control plane state into Docker Engine so that an external store is no longer required. 1.12 also introduced several new features including encryption and service load balancing. Networking features that are introduced require a Docker Engine version that supports them, and using these features with older versions of Docker Engine is not supported.
Next: **[MACVLAN](07-macvlan.md)**
Next: **[MACVLAN](07-macvlan.md)**
Loading

0 comments on commit 79a4536

Please sign in to comment.