First push to convert all Docker Hub references to Docker Cloud and Docker Store

This commit is contained in:
Mano Marks 2017-06-09 15:03:37 -07:00
Родитель 37d43795ff
Коммит 4631a05d32
44 изменённых файлов: 116 добавлений и 116 удалений

Просмотреть файл

@ -15,7 +15,7 @@ Our application exposes HTTP endPoints that are easy and quick to handle. If we
Kafka stores indexes of events processed by each worker. When a worker is restared, it can provide an index indicating at which point in time it needs to restart the event handling. Doing so no events are lost.
[Docker Hub](https://hub.docker.com) offers several image of Kafka ([Spotify](https://hub.docker.com/r/spotify/kafka/), [Wurstmeister](https://hub.docker.com/r/wurstmeister/kafka/), ...) that can easily be integrated in the docker-compose file of the application.
[Docker Store](https://store.docker.com) offers several image of Kafka ([Spotify](https://store.docker.com/community/images/spotify/kafka), [Wurstmeister](https://store.docker.com/community/images/wurstmeister/kafka), ...) that can easily be integrated in the docker-compose file of the application.
Below is an example of how Kafka (and zookeeper) could be added to our docker-compose file. Of course, this means the application has been slightly changed to be able to write and read to/from Kafka.

Просмотреть файл

@ -4,7 +4,7 @@ The different environments must be as close as possible.
Docker is very good at reducing the gap as the same services can be deployed on the developer machine as they could on any Docker Hosts.
A lot of external services are available on the Docker Hub and can be used in an existing application. Using those components enables a developer to use Postgres in development instead of SQLite or other lighter alternative. This reduces the risk of small differences that could show up later, when the app is on production.
A lot of external services are available on the Docker Store and can be used in an existing application. Using those components enables a developer to use Postgres in development instead of SQLite or other lighter alternative. This reduces the risk of small differences that could show up later, when the app is on production.
This factor shows an orientation toward continuous deployment, where development can go from dev to production in a very short timeframe, thus avoiding the big bang effect at each release.

Просмотреть файл

@ -32,7 +32,7 @@ drwxr-xr-x 5 root root 4096 Mar 2 16:20 lib
```
What happened? Behind the scenes, a lot of stuff happened. When you call `run`,
1. The Docker client contacts the Docker daemon
2. The Docker daemon dowloads the image (alpine in this case) from Docker Hub
2. The Docker daemon dowloads the image (alpine in this case) from Docker Store
3. The Docker daemon creates the container and then runs a command in that container.
4. The Docker daemon streams the output of the command to the Docker client
@ -93,7 +93,7 @@ In the last section, you saw a lot of Docker-specific jargon which might be conf
- *Containers* - Running instances of Docker images — containers run the actual applications. A container includes an application and all of its dependencies. It shares the kernel with other containers, and runs as an isolated process in user space on the host OS. You created a container using `docker run` which you did using the alpine image that you downloaded. A list of running containers can be seen using the `docker ps` command.
- *Docker daemon* - The background service running on the host that manages building, running and distributing Docker containers.
- *Docker client* - The command line tool that allows the user to interact with the Docker daemon.
- *Docker Hub* - A [registry](https://hub.docker.com/explore/) of Docker images. You can think of the registry as a directory of all available Docker images. You'll be using this later in this tutorial.
- *Docker Store* - A [registry](https://store.docker.com/) of Docker images, where you can find trusted and enterprise ready containers, plugins, and Docker editions. You'll be using this later in this tutorial.
## Next Steps
For the next step in the tutorial, head over to [2.0 Webapps with Docker](./webapps.md)

Просмотреть файл

@ -1,7 +1,7 @@
## Setup
### Prerequisites
There are no specific skills needed for this tutorial beyond a basic comfort with the command line and using a text editor. Prior experience in developing web applications will be helpful but is not required. As you proceed further along the tutorial, we'll make use of [Docker Hub](https://hub.docker.com/).
There are no specific skills needed for this tutorial beyond a basic comfort with the command line and using a text editor. Prior experience in developing web applications will be helpful but is not required. As you proceed further along the tutorial, we'll make use of [Docker Cloud](https://cloud.docker.com/).
### Setting up your computer
Getting all the tooling setup on your computer can be a daunting task, but getting Docker up and running on your favorite OS has become very easy.

Просмотреть файл

@ -21,7 +21,7 @@ cd example-voting-app
```
### 3.1 Deploying the app
For this first stage, we will use existing images that are in Docker Hub.
For this first stage, we will use existing images that are in Docker Store.
This app relies on [Docker Swarm mode](https://docs.docker.com/engine/swarm/). Swarm mode is the cluster management and orchestration features embedded in the Docker engine. You can easily deploy to a swarm using a file that declares your desired state for the app. Swarm allows you to run your containers on more than one machine. In this tutorial, you can run on just one machine, or you can use something like [Docker for AWS](https://beta.docker.com/) or [Docker for Azure](https://beta.docker.com/) to quickly create a multiple node machine. Alternately, you can use Docker Machine to create a number of local nodes on your development machine. See [the Swarm Mode lab](../../swarm-mode/beginner-tutorial/README.md#creating-the-nodes-and-swarm) for more information.
@ -260,4 +260,4 @@ docker stack rm vote
```
### 3.3 Next steps
Now that you've built some images and pushed them to docker hub, and learned the basics of Swarm mode, you can explore more of Docker by checking out [the documentation](https://docs.docker.com). And if you need any help, check out the [Docker Forums](forums.docker.com) or [StackOverflow](https://stackoverflow.com/tags/docker/).
Now that you've built some images and pushed them to Docker Cloud, and learned the basics of Swarm mode, you can explore more of Docker by checking out [the documentation](https://docs.docker.com). And if you need any help, check out the [Docker Forums](forums.docker.com) or [StackOverflow](https://stackoverflow.com/tags/docker/).

Просмотреть файл

@ -4,9 +4,9 @@ Great! So you have now looked at `docker run`, played with a Docker container an
### 2.1 Run a static website in a container
>**Note:** Code for this section is in this repo in the [static-site directory](https://github.com/docker/labs/tree/master/beginner/static-site).
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.
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 Store, 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 [`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.
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.
```
$ docker run -d dockersamples/static-site
@ -107,7 +107,7 @@ CONTAINER ID IMAGE COMMAND CREATED
### 2.2 Docker Images
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.
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 Cloud.
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.
@ -144,7 +144,7 @@ So for example, the `docker pull` command given below will pull an image named `
$ docker pull ubuntu
```
To get a new Docker image you can either get it from a registry (such as the Docker Hub) or create your own. There are hundreds of thousands of images available on [Docker hub](https://hub.docker.com). You can also search for images directly from the command line using `docker search`.
To get a new Docker image you can either get it from a registry (such as the Docker Store) or create your own. There are hundreds of thousands of images available on [Docker Store](https://store.docker.com). You can also search for images directly from the command line using `docker search`.
An important distinction with regard to images is between _base images_ and _child images_.
@ -156,7 +156,7 @@ Another key concept is the idea of _official images_ and _user images_. (Both of
- **Official images** are Docker sanctioned images. Docker, Inc. sponsors a dedicated team that is responsible for reviewing and publishing all Official Repositories content. This team works in collaboration with upstream software maintainers, security experts, and the broader Docker community. These are not prefixed by an organization or user name. In the list of images above, the `python`, `node`, `alpine` and `nginx` images are official (base) images. To find out more about them, check out the [Official Images Documentation](https://docs.docker.com/docker-hub/official_repos/).
- **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 Hub user or organization name.
- **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.
@ -258,7 +258,7 @@ Create a directory called `templates` and create an **index.html** file in that
</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://hub.docker.com/_/alpine/). We'll do that using 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.
@ -335,7 +335,7 @@ A [Dockerfile](https://docs.docker.com/engine/reference/builder/) is a text file
Now that you have your `Dockerfile`, you can build your image. The `docker build` command does the heavy-lifting of creating a docker image from a `Dockerfile`.
When you run the `docker build` command given below, make sure to replace `<YOUR_USERNAME>` with your username. This username should be the same one you created when registering on [Docker hub](https://hub.docker.com). If you haven't done that yet, please go ahead and create an account.
When you run the `docker build` command given below, make sure to replace `<YOUR_USERNAME>` with your username. This username should be the same one you created when registering on [Docker Cloud](https://cloud.docker.com). If you haven't done that yet, please go ahead and create an account.
The `docker build` command is quite simple - it takes an optional tag name with the `-t` flag, and the location of the directory containing the `Dockerfile` - the `.` indicates the current directory:
@ -422,9 +422,9 @@ Head over to `http://localhost:8888` and your app should be live. **Note** If yo
Hit the Refresh button in the web browser to see a few more cat images.
### 2.3.4 Push your image
Now that you've created and tested your image, you can push it to [Docker Hub](https://hub.docker.com).
Now that you've created and tested your image, you can push it to [Docker Cloud](https://cloud.docker.com).
First you have to login to your Docker hub account, to do that:
First you have to login to your Docker Cloud account, to do that:
```
docker login
@ -456,7 +456,7 @@ $ docker rm -f myfirstapp
Here's a quick summary of the few basic commands we used in our Dockerfile.
* `FROM` starts the Dockerfile. It is a requirement that the Dockerfile must start with the `FROM` command. Images are created in layers, which means you can use another image as the base image for your own. The `FROM` command defines your base layer. As arguments, it takes the name of the image. Optionally, you can add the Docker Hub username of the maintainer and image version, in the format `username/imagename:version`.
* `FROM` starts the Dockerfile. It is a requirement that the Dockerfile must start with the `FROM` command. Images are created in layers, which means you can use another image as the base image for your own. The `FROM` command defines your base layer. As arguments, it takes the name of the image. Optionally, you can add the Docker Cloud username of the maintainer and image version, in the format `username/imagename:version`.
* `RUN` is used to build up the Image you're creating. For each `RUN` command, Docker will run the command then create a new layer of the image. This way you can roll back your image to previous states easily. The syntax for a `RUN` instruction is to place the full text of the shell command after the `RUN` (e.g., `RUN mkdir /user/local/foo`). This will automatically run in a `/bin/sh` shell. You can define a different shell like this: `RUN /bin/bash -c 'mkdir /user/local/foo'`
@ -475,7 +475,7 @@ Here's a quick summary of the few basic commands we used in our Dockerfile.
>**Note:** The `EXPOSE` command does not actually make any ports accessible to the host! Instead, this requires
publishing ports by means of the `-p` flag when using `$ docker run`.
* `PUSH` pushes your image to Docker Hub, or alternately to a [private registry](https://docs.docker.com/registry/)
* `PUSH` pushes your image to Docker Cloud, or alternately to a [private registry](https://docs.docker.com/registry/)
>**Note:** If you want to learn more about Dockerfiles, check out [Best practices for writing Dockerfiles](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/).

Просмотреть файл

@ -5,7 +5,7 @@
=== Network Timed Out
Depending upon the network speed and restrictions, you may not be able to download Docker images from Docker Hub. The error message may look like:
Depending upon the network speed and restrictions, you may not be able to download Docker images from Docker Store. The error message may look like:
```console
$ docker pull arungupta/wildfly-mysql-javaee7

Просмотреть файл

@ -22,14 +22,14 @@ Docker has three main components:
. __Images__ are the *build component* of Docker and are the read-only templates defining an application operating system.
. __Containers__ are the *run component* of Docker and created from images. Containers can be run, started, stopped, moved, and deleted.
. Images are stored, shared, and managed in a __registry__ and are the *distribution component* of Docker. Docker Hub is a publicly available registry and is available at http://hub.docker.com.
. Images are stored, shared, and managed in a __registry__ and are the *distribution component* of Docker. Docker Store is a publicly available registry and is available at http://store.docker.com.
In order for these three components to work together, the *Docker Daemon* (or Docker Engine) runs on a host machine and does the heavy lifting of building, running, and distributing Docker containers. In addition, the *Client* is a Docker binary which accepts commands from the user and communicates back and forth with the Engine.
.Docker architecture
image::docker-architecture.png[]
The Client communicates with the Engine that is either co-located on the same host or on a different host. Client uses the `pull` command to request the Engine to pull an image from the registry. The Engine then downloads the image from Docker Hub, or whichever registry is configured. Multiple images can be downloaded from the registry and installed on the Engine. Client uses the `run` run the container.
The Client communicates with the Engine that is either co-located on the same host or on a different host. Client uses the `pull` command to request the Engine to pull an image from the registry. The Engine then downloads the image from Docker Store, or whichever registry is configured. Multiple images can be downloaded from the registry and installed on the Engine. Client uses the `run` run the container.
**How does a Docker Image work?**
@ -39,7 +39,7 @@ One of the reasons Docker is so lightweight is because of these layers. When you
Every image starts from a base image, for example `ubuntu`, a base Ubuntu image, or `fedora`, a base Fedora image. You can also use images of your own as the basis for a new image, for example if you have a base Apache image you could use this as the base of all your web application images.
NOTE: By default, Docker obtains these base images from Docker Hub.
NOTE: By default, Docker obtains these base images from Docker Store.
Docker images are then built from these base images using a simple, descriptive set of steps we call instructions. Each instruction creates a new layer in our image. Instructions include actions like:

Просмотреть файл

@ -2,7 +2,7 @@
= Run a Docker Container
The first step in running any application using Docker is to run a container. There are plenty of images available at https://hub.docker.com[Docker Hub]. Docker client can simply run the container by giving the image. The client will check if the image already exists on Docker Host. If it exists then it'll run the containers, otherwise the host will first download the image.
The first step in running any application using Docker is to run a container. There are plenty of images available at https://store.docker.com[Docker Store]. Docker client can simply run the container by giving the image. The client will check if the image already exists on Docker Host. If it exists then it'll run the containers, otherwise the host will first download the image.
== Pull Image

Просмотреть файл

@ -34,7 +34,7 @@ Right-click on Docker node and select "`Pull...`".
image::docker-netbeans-pull-image.png[]
Type the image name to narrow down the search from Docker Hub:
Type the image name to narrow down the search from Docker Store:
image::docker-netbeans-search-image.png[]

Просмотреть файл

@ -8,13 +8,13 @@
* There are several possibilities to create the image
* extend an official Linux distribution image (Ubuntu, CentOS, ...) and install Node.js runtime
* use the official Node.js image (https://hub.docker.com/_/node/)
* use the official Node.js image (https://store.docker.com/images/node)
We'll go for the second option as it offers an optimized image.
## Database
* Usage of the official [MongoDB image](https://hub.docker.com/_/mongo/)
* Usage of the official [MongoDB image](https://store.docker.com/images/mongo)
## Dockerfile

Просмотреть файл

@ -24,10 +24,10 @@ The following procedure describes how to create a repository on Docker Hub and p
## Create image
* Image needs to be created using username of the Docker hub account
* Image needs to be created using username of the Docker Cloud account
```docker build -t lucj/message-app .```
## Push image to Docker Hub
## Push image to Docker Cloud
Before publishing an image, authentication must be performed with the following command:
```docker login```

Просмотреть файл

@ -192,7 +192,7 @@ Several containers of the app service (our Node.js API) are running and are acce
## Usage of dockercloud/haproxy image
[dockercloud/haproxy](https://hub.docker.com/r/dockercloud/haproxy/) is a good candidate to be used in front of our **app** service.
[dockercloud/haproxy](https://store.docker.com/images/haproxy) is a good candidate to be used in front of our **app** service.
It will update it's configuration each time a container is started / stopped.
![load balancer](https://dl.dropboxusercontent.com/u/2330187/docker/labs/node/single_host_net_2.png)

Просмотреть файл

@ -14,7 +14,7 @@ Several steps are needed to run the key value store
* Create dedicated Docker host with Machine ```docker-machine create -d virtualbox consul```
* Switch to the context of the newly created host ```eval "$(docker-machine env consul)"```
* Run container based on [progirum/consul image](https://hub.docker.com/r/progrium/consul/) ```docker run -d -p "8500:8500" -h "consul" progrium/consul -server -bootstrap```
* Run container based on [progirum/consul image](https://store.docker.com/images/consul) ```docker run -d -p "8500:8500" -h "consul" progrium/consul -server -bootstrap```
## Creation of Docker hosts that will run application containers

Просмотреть файл

@ -104,7 +104,7 @@ http {
}
```
Let's build and publish the image of this load-balancer to Docker Hub:
Let's build and publish the image of this load-balancer to Docker Cloud:
```
# Create image

Просмотреть файл

@ -16,7 +16,7 @@ Some of the Docker basics will be reviewed but it is recommended to follow [Dock
[Create the application's image](2_application_image.md)
[Publish image on Docker Hub](3_publish_image.md)
[Publish image on Docker Store](3_publish_image.md)
[Single Docker host networking](4_single_host_networking.md)

Просмотреть файл

@ -5,7 +5,7 @@
* created image for the application
* containing all the parts to run the application (runtime Node.js, librairies, application code)
* portable image (dev / test / qa / prod) available through the Docker Hub
* portable image (dev / test / qa / prod) available through Docker Cloud
* scalability of the application (API)
* on a single node (for dev / test purposes)

Просмотреть файл

@ -14,7 +14,7 @@ Earlier versions of Ruby are used in production because upgrading presents chall
As a result, Ruby developers (and people deploying Ruby apps) rely on tools like [rvm](https://rvm.io/) or [rbenv](https://github.com/rbenv/rbenv) to install a specific version of Ruby. These tools enable developers to switch between different versions of Ruby, and between different sets of gems (when different applications have conflicting requirements).
Ruby programmers expect to be able to request a specific version of Ruby on demand. This is not currently available on Docker Hub and developers will have to create Dockerfiles that are specific to development environment requirements. Docker Hub currently has Ruby 2.1, 2.2, 2.3; which means the images on Docker Hub can support newer applications. However, migrating older applications to a container may require custom builds to meet Ruby version requirements.
Ruby programmers expect to be able to request a specific version of Ruby on demand. This is not currently available on Docker Store and developers will have to create Dockerfiles that are specific to development environment requirements. Docker Store currently has Ruby 2.1, 2.2, 2.3; which means the images on Docker Store can support newer applications. However, migrating older applications to a container may require custom builds to meet Ruby version requirements.
#### Use RVM to manage Ruby Versions
@ -204,7 +204,7 @@ As indicated above, many things (including asset pre-compilation) require databa
Here are additional sources to checkout.
* [Ruby on Docker Hub](https://hub.docker.com/_/ruby/)
* [Ruby on Docker Store](https://store.docker.com/images/ruby)
* [Compose and Rails Quickstart](https://docs.docker.com/compose/rails/)
* [Rails & Assets with Docker](http://red-badger.com/blog/2016/06/22/docker-and-assets-and-rails-oh-my/)
* [Docker on Rails Demo](https://github.com/cpuguy83/docker-rails-dev-demo)

Просмотреть файл

@ -105,7 +105,7 @@ Docker runs natively on Windows 10 and Windows Server 2016. In this lab you'll l
## [Modernize .NET Apps - for Devs](./windows-modernize-aspnet-dev)
You can run full .NET Framework apps in Docker using the [Windows Server Core](https://hub.docker.com/r/microsoft/windowsservercore/) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS](https://hub.docker.com/r/microsoft/iis/) and [ASP.NET](https://hub.docker.com/r/microsoft/aspnet/), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.
You can run full .NET Framework apps in Docker using the [Windows Server Core](https://store.docker.com/images/windowsservercore) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS](https://store.docker.com/images/iis) and [ASP.NET](https://store.docker.com/images/aspnet), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.
This lab steps through porting an ASP.NET WebForms app to run in a Docker container on Windows Server 2016. With the app running in Docker, you can easily modernize it - and in the lab you'll add new features quickly and safely by making use of the Docker platform.

Просмотреть файл

@ -36,7 +36,7 @@ In order to complete this lab, you will need the following:
### Obtain a Docker ID
If you do not already have a Docker ID, you will need to create one now. Creating a Docker ID is free, and allows you to use both [Docker Cloud](https://cloud.docker.com) and [Docker Hub](https://hub.docker.com).
If you do not already have a Docker ID, you will need to create one now. Creating a Docker ID is free, and allows you to use [Docker Cloud](https://cloud.docker.com).
If you already have a Docker ID, skip to the next prerequisite.

Просмотреть файл

@ -249,7 +249,7 @@ ID NAME MODE REPLICAS IMAGE
of5rxsxsmm3a sleep-app replicated 1/1 ubuntu:latest
```
The state of the service may change a couple times until it is running. The image is being downloaded from Docker Hub to the other engines in the Swarm. Once the image is downloaded the container goes into a running state on one of the three nodes.
The state of the service may change a couple times until it is running. The image is being downloaded from Docker Store to the other engines in the Swarm. Once the image is downloaded the container goes into a running state on one of the three nodes.
At this point it may not seem that we have done anything very differently than just running a `docker run ...`. We have again deployed a single container on a single host. The difference here is that the container has been scheduled on a swarm cluster.

Просмотреть файл

@ -15,7 +15,7 @@ Docker runs natively on Windows 10 and Windows Server 2016. In this lab you'll l
> * [Task 1.3: Run a background IIS web server container](#task1.3)
> * [Task 2: Package and run a custom app using Docker](#task2)
> * [Task 2.1: Build a custom website image](#task2.1)
> * [Task 2.2: Push your image to Docker Hub](#task2.2)
> * [Task 2.2: Push your image to Docker Cloud](#task2.2)
> * [Task 2.3: Run your website in a container](#task2.3)
> * [Task 3: Run your app in a highly-available cluster](#task3)
> * [Task 3.1: Create a Docker swarm with Windows Server nodes](#task3.1)
@ -40,9 +40,9 @@ You will need a set of Windows Server 2016 virtual machines running in Azure, wh
> When you connect to the VM, if you are prompted to run Windows Update, you should cancel out. The labs have been tested with the existing VM state and any changes may cause problems.
You will build images and push them to Docker Hub, so you can pull them on different Docker hosts. You will need a Docker ID.
You will build images and push them to Docker Cloud, so you can pull them on different Docker hosts. You will need a Docker ID.
- Sign up for a free Docker ID on [Docker Hub](https://hub.docker.com)
- Sign up for a free Docker ID on [Docker Cloud](https://cloud.docker.com)
## Prerequisite Task: Prepare your lab environment
@ -89,7 +89,7 @@ docker run microsoft/nanoserver powershell Write-Output Hello DockerCon 2017!
You'll see the output written from the PowerShell command. Here's what Docker did:
- created a new container from the [microsoft/nanoserver](https://hub.docker.com/r/microsoft/nanoserver/) image, which has a basic Nano Server deployment, maintained by Microsoft
- created a new container from the [microsoft/nanoserver](https://store.docker.com/images/nanoserver) image, which has a basic Nano Server deployment, maintained by Microsoft
- started the container, running the `powershell` command and passing the `Write-Output...` arguments
- relayed the console output from the container to the PowerShell window
@ -106,7 +106,7 @@ Containers which do one task and then exit can be very useful. You could build a
## <a name="task1.2"></a>Task 1.2: Run an interactive Windows Server Core container
Nano Server is a new operating system from Microsoft which supports a subset of the full Windows APIs. You can use it to package cross-platform applications like Java, Go, Node.js and .NET Core, but not full .NET Framework apps. For that there's the [microsoft/windowsservercore](https://hub.docker.com/r/microsoft/windowsservercore) image which is a full Windows Server 2016 OS, without the UI.
Nano Server is a new operating system from Microsoft which supports a subset of the full Windows APIs. You can use it to package cross-platform applications like Java, Go, Node.js and .NET Core, but not full .NET Framework apps. For that there's the [microsoft/windowsservercore](https://store.docker.com/images/windowsservercore) image which is a full Windows Server 2016 OS, without the UI.
You can explore an image by running an interactive container. Run this to start a Windows Server Core container and connect to it:
@ -125,7 +125,7 @@ Run some commands to see how the Windows Server Core image is built:
- `Get-Process` - shows all running processes in the container. There are a number of Windows Services, and the PowerShell exe
- `Get-WindowsFeature` - shows the Windows feature which are available or already installed
You'll see that the base image has .NET 4.6 installed, which is backwards-compatible so you can run .NET 2.0 apps. Almost all Windows Server features are available (.NET 3.5 is an exception, but the [microsoft/aspnet:3.5](https://hub.docker.com/r/microsoft/aspnet/) image comes with that installed). You can install them with the `Add-WindowsFeature` cmdlet, which is how you would start to build up a custom application image from the base image, adding in the features you need.
You'll see that the base image has .NET 4.6 installed, which is backwards-compatible so you can run .NET 2.0 apps. Almost all Windows Server features are available (.NET 3.5 is an exception, but the [microsoft/aspnet:3.5](https://store.docker.com/images/aspnet/) image comes with that installed). You can install them with the `Add-WindowsFeature` cmdlet, which is how you would start to build up a custom application image from the base image, adding in the features you need.
Interactive containers are useful when you are putting together your own image. You can run a container and verify all the steps you need to deploy your app. Once you have it working, you can [commit](https://docs.docker.com/engine/reference/commandline/commit/) a running container to an image - but it's much better to capture those steps in a repeatable [Dockerfile](https://docs.docker.com/engine/reference/builder/). You'll do that in a later task.
@ -134,7 +134,7 @@ Now run `exit` to leave the PowerShell session. That stops the container process
## <a name="task1.3"></a>Run a background IIS web server container
Background containers are how you'll run your application. Here's a simple exmaple using another image from Microsoft - [microsoft/iis](https://hub.docker.com/r/microsoft/iis/) which builds on top of the Windows Server Core image and installs the IIS Web Server feature:
Background containers are how you'll run your application. Here's a simple exmaple using another image from Microsoft - [microsoft/iis](https://store.docker.com/images/iis) which builds on top of the Windows Server Core image and installs the IIS Web Server feature:
```
docker run -d -p 80:80 --name iis microsoft/iis
@ -164,7 +164,7 @@ It's important to realize that the container process - `w3wp.exe` in this case -
Next you'll learn how to package your own Windows app as a Docker image, using a [Dockerfile](https://docs.docker.com/engine/reference/builder/).
The Dockerfile is a simple script which contains all the steps to deploy your application. You need to use an existing image as the starting point for your app, but you decide which one. You can use the base Windows Server or Nano Server image, or an [official image](https://docs.docker.com/docker-hub/official_repos/) with the app platform you need already installed - like [openjdk:windowsservercore](https://hub.docker.com/_/openjdk/) which is good for running Java apss in Windows Docker containers.
The Dockerfile is a simple script which contains all the steps to deploy your application. You need to use an existing image as the starting point for your app, but you decide which one. You can use the base Windows Server or Nano Server image, or an [official image](https://docs.docker.com/docker-hub/official_repos/) with the app platform you need already installed - like [openjdk:windowsservercore](https://store.docker.com/images/openjdk) which is good for running Java apss in Windows Docker containers.
The Dockerfile syntax is simple. In this task you'll walk through a Dockerfile for a custom website, and see how to package and run it with Docker.
@ -192,7 +192,7 @@ docker build -t <DockerID>/dockercon-tweet-app .
-`-t` tags the image, giving it a name you use to push the image or run containers
> Be sure to use your Docker ID in the image tag. You will share it on Docker Hub in the next step, and you can only do that if you use your ID. My Docker ID is `sixeyed`, so I run `docker build -t sixeyed/dockercon-tweet-app`
> Be sure to use your Docker ID in the image tag. You will share it on Docker Cloud in the next step, and you can only do that if you use your ID. My Docker ID is `sixeyed`, so I run `docker build -t sixeyed/dockercon-tweet-app`
You'll see output on the screen as Docker runs each instruction in the Dockerfile, starting like this:
@ -217,15 +217,15 @@ sixeyed/dockercon-tweet-app latest a14860778046 11 minutes
Docker has built the image but it's only stored on the local machine. Next we'll push it to a public repository.
## <a name="task2.2"></a>Task 2.2: Push your image to Docker Hub
## <a name="task2.2"></a>Task 2.2: Push your image to Docker Cloud
Distribution is built into the Docker platform. You can build images locally and push them to a [registry](https://docs.docker.com/registry/), making them available to other users. Anyone with access can pull that image and run a container from it. The behavior of the app in the container will be the same for everyone, because the image contains the fully-configured app - the only requirements to run it are Windows and Docker.
[Docker Hub](https://hub.docker.com) is the public registry for Docker images. You can push your website image to the Hub, and later in the lab we'll pull it on other servers and run it on a cluster. To push images, you need to log in using the command line and providing your Docker ID credentials:
You can push your website image to [Docker Cloud](https://cloud.docker.com), and later in the lab we'll pull it on other servers and run it on a cluster. When you push to Cloud, if you make it a public repository, it is also available to others on [Docker Store](https://store.docker.com), the public registry for Docker images. To push images, you need to log in using the command line and providing your Docker ID credentials:
```
> docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Login with your Docker ID to push and pull images from Docker Cloud. If you don't have a Docker ID, head over to https://cloud.docker.com to create one.
Username: <DockerID>
Password:
Login Succeeded
@ -237,9 +237,9 @@ Now upload your image to the Hub:
docker push <DockerID>/dockercon-tweet-app
```
You'll see the upload progress for each layer in the Docker image. The IIS layer is almost 300MB so that will take a few seconds. The whole image is over 10GB, but the bulk of that is in the Windows Server Core base image. Those layers are already stored in Docker Hub, so they don't get uploaded - only the new parts of the image get pushed.
You'll see the upload progress for each layer in the Docker image. The IIS layer is almost 300MB so that will take a few seconds. The whole image is over 10GB, but the bulk of that is in the Windows Server Core base image. Those layers are already stored in Docker Cloud, so they don't get uploaded - only the new parts of the image get pushed.
You can browse to [https://hub.docker.com/r/&lt;DockerID&gt;/dockercon-tweet-app/](https://hub.docker.com/r/<DockerID>/dockercon-tweet-app/) and see your newly-pushed app image. This is a public repository, so anyone can pull the image - you don't even need a Docker ID to pull public images.
You can browse to [https://store.docker.com/community/images/&lt;DockerID&gt;/dockercon-tweet-app](https://store.docker.com/community/images/DockerID/dockercon-tweet-app) and see your newly-pushed app image. This is a public repository, so anyone can pull the image - you don't even need a Docker ID to pull public images.
## <a name="task2.3"></a>Task 2.3: Run your website in a container
@ -266,7 +266,7 @@ Go ahead and hit the button to Tweet about your lab progress! No data gets store
## <a name="task3"></a>Task 3: Run your app in a highly-available cluster
Your app is packaged in a portable Docker image, and you can rebuild it any time with a simple script. You've shared it on Docker Hub and deployed it on a cloud server, but at the moment you just have a single VM serving your app. That doesn't give you high availability, and for a tier 1 app like this you'll want to avoid downtime if there are any issues with the VM.
Your app is packaged in a portable Docker image, and you can rebuild it any time with a simple script. You've shared it on Docker Cloud and deployed it on a cloud server, but at the moment you just have a single VM serving your app. That doesn't give you high availability, and for a tier 1 app like this you'll want to avoid downtime if there are any issues with the VM.
Docker supports failover and scaling with a clustering technology built right into the engine - [Docker swarm mode](https://docs.docker.com/engine/swarm/). You don't need anything extra to turn a set of machines into a highly-available cluster, just Windows and Docker. In the rest of this lab you'll set up a swarm of three VMs and deploy the web app on the swarm.

Просмотреть файл

@ -1,6 +1,6 @@
# Modernize .NET Apps - for Devs
You can run full .NET Framework apps in Docker using the [Windows Server Core](https://hub.docker.com/r/microsoft/windowsservercore/) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS](https://hub.docker.com/r/microsoft/iis/) and [ASP.NET](https://hub.docker.com/r/microsoft/aspnet/), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.
You can run full .NET Framework apps in Docker using the [Windows Server Core](https://store.docker.com/images/windowsservercore) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS](https://store.docker.com/images/iis) and [ASP.NET](https://store.docker.com/images/aspnet), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.
This lab steps through porting an ASP.NET WebForms app to run in a Docker container on Windows Server 2016. With the app running in Docker, you can easily modernize it - and in the lab you'll add new features quickly and safely by making use of the Docker platform.
@ -55,9 +55,9 @@ You need a set of Windows Server 2016 virtual machines running in Azure, which a
> When you connect to the VM, if you are prompted to run Windows Update, you should cancel out. The labs have been tested with the existing VM state and any changes may cause problems.
You will build images and push them to Docker Hub, so you can pull them on different Docker hosts. You will need a Docker ID.
You will build images and push them to Docker Cloud, so you can pull them on different Docker hosts. You will need a Docker ID.
- Sign up for a free Docker ID on [Docker Hub](https://hub.docker.com)
- Sign up for a free Docker ID on [Docker Cloud](https://cloud.docker.com)
## Prerequisite Task: Prepare your lab environment
@ -185,7 +185,7 @@ cd C:\scm\github\docker\dcus-hol-2017\windows-modernize-aspnet-dev\v1-src\docker
docker build -t <DockerID>/modernize-aspnet-web:v1 .
```
> Be sure to tag the image with your own Docker ID so you can push it to Docker Hub.
> Be sure to tag the image with your own Docker ID so you can push it to Docker Cloud.
## <a name="task2.2"></a>Task 2.2: Connecting to SQL Server in a Docker container
@ -207,7 +207,7 @@ When you run the web application, the DNS server in the Docker platform will res
## <a name="task2.3"></a>Task 2.3: Running the database and web app in containers
Microsoft provide a SQL Server Express image on Docker Hub, which is already pulled on your lab VM. Run it in a container with this command to set up the expected credentials and DNS name:
Microsoft provide a SQL Server Express image on Docker Store, which is already pulled on your lab VM. Run it in a container with this command to set up the expected credentials and DNS name:
```
docker run --detach `
@ -270,7 +270,7 @@ MessageQueue.Publish(eventMessage);
The `ProspectSignedUpEvent` contains a `Prospect` object, populated from the webform input. The `MessageQueue` class is just a wrapper to abstract the type of message queue. In this lab you'll be using [NATS](https://nats.io), a high-performance, low-latency, cross-platform and open-source message server.
NATS is available as an [official image](https://hub.docker.com/_/nats/) on Docker Hub, which means it's a curated image that you can rely on for quality. Publishing a Message to NATS means multiple subscribers can listen for the event, and you start to bring [event-driven architecture](https://msdn.microsoft.com/en-us/library/dd129913.aspx) into the application - just for the one feature that needs it, without a full rewrite of the app.
NATS is available as an [official image](https://store.docker.com/images/nats) on Docker Store, which means it's a curated image that you can rely on for quality. Publishing a Message to NATS means multiple subscribers can listen for the event, and you start to bring [event-driven architecture](https://msdn.microsoft.com/en-us/library/dd129913.aspx) into the application - just for the one feature that needs it, without a full rewrite of the app.
There's another change to the web app to use environment variables for configuration settings, using the [Config](v2-src/ProductLaunch/ProductLaunch.Model/Config.cs) class rather than `web.config`. That means we can set the database connection string through the Docker platform and use the same image in every environment.

Просмотреть файл

@ -54,9 +54,9 @@ You will need a set of Windows Server 2016 virtual machines running in Azure, wh
> When you connect to the VM, if you are prompted to run Windows Update, you should cancel out. The labs have been tested with the existing VM state and any changes may cause problems.
You will build images and push them to Docker Hub, so you can pull them on different Docker hosts. You will need a Docker ID.
You will build images and push them to Docker Cloud, so you can pull them on different Docker hosts. You will need a Docker ID.
- Sign up for a free Docker ID on [Docker Hub](https://hub.docker.com)
- Sign up for a free Docker ID on [Docker Cloud](https://cloud.docker.com)
## Prerequisite Task: Prepare your lab environment
@ -79,7 +79,7 @@ docker swarm leave -f
## <a name="task1"></a>Task 1: Packaging ASP.NET apps as Docker images
A Docker image packages your application and all the dependencies it needs to run into one unit. Microsoft maintain the [microsoft/aspnet](https://hub.docker.com/r/microsoft/aspnet/) image on Docker Hub, which you can use as the basis for your own application images. It is based on [microsoft/windowsservercore](https://hub.docker.com/r/microsoft/windowsservercore/) and has IIS and ASP.NET already installed.
A Docker image packages your application and all the dependencies it needs to run into one unit. Microsoft maintain the [microsoft/aspnet](https://store.docker.com/images/aspnet) image on Docker Store, which you can use as the basis for your own application images. It is based on [microsoft/windowsservercore](https://store.docker.com/images/windowsservercore) and has IIS and ASP.NET already installed.
In this lab you'll start with an MSI that deploys a web app onto a server and expects IIS and ASP.NET to be configured. If you already have a scripted build process then you may have MSIs or Web Deploy packages already being generated, and it's easy to package them into a Docker image.
@ -87,7 +87,7 @@ In this lab you'll start with an MSI that deploys a web app onto a server and ex
Building a Docker image from an MSI is simple, you just need to copy in the `msi` file and run `msiexec` to install it. Have a look at the [Dockerfile](v1.0/Dockerfile) for the app you're going to deploy and later upgrade.
> If you noticed the version of [microsoft/windowsservercore](https://hub.docker.com/r/microsoft/windowsservercore/) is an old one - that's deliberate. You'll be updating the Windows version as well as the app version in this lab.
> If you noticed the version of [microsoft/windowsservercore](https://store.docker.com/images/windowsservercore) is an old one - that's deliberate. You'll be updating the Windows version as well as the app version in this lab.
There are just three lines of [Dockerfile instructions](https://docs.docker.com/engine/reference/builder/):
@ -104,13 +104,13 @@ cd C:\scm\github\docker\dcus-hol-2017\windows-modernize-aspnet-ops\v1.0
docker build -t <DockerID>/modernize-aspnet-ops:1.0 .
```
> Be sure to tag the image with your own Docker ID - you'll be pushing it to Docker Hub next.
> Be sure to tag the image with your own Docker ID - you'll be pushing it to Docker Cloud next.
The output from `docker build` shows you the Docker engine executing all the steps in the Dockerfile. On your lab VM the base images have already been pulled, so the image should build quickly.
When the build completes you'll have a new image stored locally, with the name `<DockerId>/modernize-aspnet-ops` and the tag `1.0` indicating that this is version 1.0 of the app.
Login to Docker Hub with your Docker ID and push that image, so it's available for the other VMs you'll use later on:
Login to Docker Cloud with your Docker ID and push that image, so it's available for the other VMs you'll use later on:
```
docker login
@ -148,7 +148,7 @@ Open a browser on your laptop and browse to the app on your VM: **http://&lt;azu
The Docker image tagged `1.0` is a snapshot of the application, built with a specific version of the app and a specific version of Windows. When you have an upgrade to the app or an operating system update you don't make changes to the running container - you build a new Docker image which packages the updated components and replace the container with a new one.
Microsoft are releasing [regular updates to the Windows base images](https://hub.docker.com/r/microsoft/windowsservercore/tags/) on Docker Hub. When your applications are running in Docker containers, there is no 'Patch Tuesday' with manual or semi-automated update processes. The Docker build process is fully automated, so when a new version of the base image is released with security patches, you just need to rebuild your own images and replace the running containers.
Microsoft are releasing [regular updates to the Windows base images](https://store.docker.com/images/windowsservercore) on Docker Store. When your applications are running in Docker containers, there is no 'Patch Tuesday' with manual or semi-automated update processes. The Docker build process is fully automated, so when a new version of the base image is released with security patches, you just need to rebuild your own images and replace the running containers.
## <a name="task2"></a>Task 2.1: Updating Windows and app versions
@ -208,7 +208,7 @@ The new website content shows the updated application version number, which is r
In non-production environments you can upgrade just by killing the old container and starting a new one, using the new image and mapping to the original port. That's a manual approach which will incur a few seconds downtime. Docker provides an automated, zero-downtime alternative which you'll use instead.
For that you'll create a swarm, clustering all three of your lab VMs. The other nodes will need the upgraded image, so push version 1.1 to Docker Hub too:
For that you'll create a swarm, clustering all three of your lab VMs. The other nodes will need the upgraded image, so push version 1.1 to Docker Cloud too:
```
docker push <DockerID>/modernize-aspnet-ops:1.1

Просмотреть файл

@ -57,7 +57,7 @@ Community and vendor created IPAM drivers can also be used to provide integratio
| Driver | Description |
|------|------|
| [**infoblox**](https://hub.docker.com/r/infoblox/ipam-driver/) | An open source IPAM plugin that provides integration with existing Infoblox tools. |
| [**infoblox**](https://store.docker.com/community/images/infoblox/ipam-driver) | An open source IPAM plugin that provides integration with existing Infoblox tools. |
> There are many Docker plugins that exist and more are being created all the time. Docker maintains a list of the [most common plugins.](https://docs.docker.com/engine/extend/legacy_plugins/)

Просмотреть файл

@ -1,6 +1,6 @@
# Linux Registry Lab
A registry is a service for storing and accessing Docker images. [Docker Hub](https://hub.docker.com) and [Docker Store](https://store.docker.com) are the best-known hosted registries, which you can use to store public and private images. You can also run your own registry using the open-source [Docker Registry](https://docs.docker.com/registry), which is a Go application in a Alpine Linux container.
A registry is a service for storing and accessing Docker images. [Docker Cloud](https://cloud.docker.com) and [Docker Store](https://store.docker.com) are the best-known hosted registries, which you can use to store public and private images. You can also run your own registry using the open-source [Docker Registry](https://docs.docker.com/registry), which is a Go application in a Alpine Linux container.
## What You Will Learn
@ -12,7 +12,7 @@ You'll learn how to:
- generate encrypted passwords (using Docker!) and run an authenticated, secure local registry over HTTPS with basic auth.
> Note. The open-source registry does not have a Web UI, so there's no friendly interface like [Docker Hub](https://hub.docker.com) or [Docker Store](https://store.docker.com). Instead there is a [REST API](https://docs.docker.com/registry/spec/api/) you can use to query the registry. For a local registry which has a Web UI and role-based access control, Docker, Inc. has the [Trusted Registry](https://www.docker.com/sites/default/files/Docker%20Trusted%20Registry.pdf) product.
> Note. The open-source registry does not have a Web UI, so there's no friendly interface like [Docker Cloud](https://cloud.docker.com) or [Docker Store](https://store.docker.com). Instead there is a [REST API](https://docs.docker.com/registry/spec/api/) you can use to query the registry. For a local registry which has a Web UI and role-based access control, Docker, Inc. has the [Trusted Registry](https://www.docker.com/sites/default/files/Docker%20Trusted%20Registry.pdf) product.
### Prerequisites

Просмотреть файл

@ -28,7 +28,7 @@ First we'll test that the registry image is working correctly, by running it wit
$ sudo docker run -d -p 5000:5000 --name registry registry:2
```
## Understanding Image Names
Typically we work with images from the Docker Hub, which is the default registry for the Docker Engine. Commands using just the image repository name work fine, like this:
Typically we work with images from the Docker Store, which is the default registry for the Docker Engine. Commands using just the image repository name work fine, like this:
```
$ sudo docker pull hello-world
```
@ -38,7 +38,7 @@ $ sudo docker pull hello-world
- `hello-world` - the repository name, in this case in `{imageName}` format;
- `latest` - the image tag.
If a tag isn't specified, then the default `latest` is used. If a registry hostname isn't specified then the default `docker.io` for Docker Hub is used. If you want to use images with any other registry, you need to explicitly specify the hostname - the default is always Docker Hub, you can't change to a different default registry.
If a tag isn't specified, then the default `latest` is used. If a registry hostname isn't specified then the default `docker.io` for Docker Store is used. If you want to use images with any other registry, you need to explicitly specify the hostname - the default is always Docker Store, you can't change to a different default registry.
With a local registry, the hostname and the custom port used by the registry is the full registry address, e.g. `localhost:5000`.
```
@ -49,7 +49,7 @@ $ hostname
Docker uses the hostname from the full image name to determine which registry to use. We can build images and include the local registry hostname in the image tag, or use the `docker tag` command to add a new tag to an existing image.
These commands pull a public image from Docker Hub, tag it for use in the private registry with the full name `localhost:5000/hello-world`, and then push it to the registry:
These commands pull a public image from Docker Store, tag it for use in the private registry with the full name `localhost:5000/hello-world`, and then push it to the registry:
```
$ sudo docker tag hello-world localhost:5000/hello-world

Просмотреть файл

@ -70,7 +70,7 @@ Using default tag: latest
Error response from daemon: Get https://localhost:5000/v2/hello-world/manifests/latest: no basic auth credentials
```
The result is the same for valid and invalid image names, so you can't even check a repository exists without authenticating. Logging in to the registry is the same `docker login` command you use for Docker Hub, specifying the registry hostname:
The result is the same for valid and invalid image names, so you can't even check a repository exists without authenticating. Logging in to the registry is the same `docker login` command you use for Docker Store, specifying the registry hostname:
```
$ sudo docker login registry.local:5000
@ -95,7 +95,7 @@ Digest: sha256:961497c5ca49dc217a6275d4d64b5e4681dd3b2712d94974b8ce4762675720b4
Status: Image is up to date for registry.local:5000/hello-world:latest
```
> Note. The open-source registry does not support the same authorization model as Docker Hub or Docker Trusted Registry. Once you are logged in to the registry, you can push and pull from any repository, there is no restriction to limit specific users to specific repositories.
> Note. The open-source registry does not support the same authorization model as Docker Store or Docker Trusted Registry. Once you are logged in to the registry, you can push and pull from any repository, there is no restriction to limit specific users to specific repositories.
## Using Docker Compose to Start the Registry
Typing in all the options to start the registry can become tedious. An easier and simpler way is to use [Docker Compose](https://docs.docker.com/compose/). Here's an example of a `docker-compose.yml` file that will start the registry.
@ -125,8 +125,8 @@ $ sudo docker-compose up
## Conclusion
[Docker Registry](https://docs.docker.com/registry/) is a free, open-source application for storing and accessing Docker images. You can run the registry in a container on your own network, or in a virtual network in the cloud, to host private images with secure access. For Linux hosts, there is an [official registry image](https://hub.docker.com/_/registry/) on Docker Hub.
[Docker Registry](https://docs.docker.com/registry/) is a free, open-source application for storing and accessing Docker images. You can run the registry in a container on your own network, or in a virtual network in the cloud, to host private images with secure access. For Linux hosts, there is an [official registry image](https://store.docker.com/images/registry) on Docker Store.
We've covered all the options, from running an insecure registry, through adding SSL to encrypt traffic, and finally adding basic authentication to restrict access. By now you know how to set up a usable registry in your own environment, and you've also used some key Docker patterns - using containers as build agents and to run basic commands, without having to install software on your host machines.
There is still more you can do with Docker Registry - using a different [storage driver](https://docs.docker.com/registry/storage-drivers/) so the image data is saved to reliable share storage, and setting up your registry as a [caching proxy for Docker Hub](https://docs.docker.com/registry/recipes/mirror/) are good next steps.
There is still more you can do with Docker Registry - using a different [storage driver](https://docs.docker.com/registry/storage-drivers/) so the image data is saved to reliable share storage, and setting up your registry as a [caching proxy for Docker Store](https://docs.docker.com/registry/recipes/mirror/) are good next steps.

Просмотреть файл

@ -65,13 +65,13 @@ In this step you have seen how easy it is to enable Docker Content Trust (export
# <a name="push"></a>Step 2: Push and sign an image
In this step you will tag an image and push it to a new repository within your own namespace on Docker Hub. You will perform this step from the host that you enabled Docker Content Trust on in the previous step. This will ensure that the image gets signed when you push it.
In this step you will tag an image and push it to a new repository within your own namespace on Docker Cloud. You will perform this step from the host that you enabled Docker Content Trust on in the previous step. This will ensure that the image gets signed when you push it.
To complete this step you will need a Docker ID.
Execute all of the following commands from **node1** (or whichever node you used for the previous step).
1. Tag the `alpine:latest` image so that it can be pushed to a new repository in your namespace on Docker Hub.
1. Tag the `alpine:latest` image so that it can be pushed to a new repository in your namespace on Docker Cloud.
This command will add the following additional tag to the `alpine:latest` image: `nigelpoulton/sec-test:latest`. The format of the tag is **docker-id/repo-name/image-tag**. Be sure to replace the **docker-id** in the following command with your own Docker ID.
@ -88,17 +88,17 @@ Execute all of the following commands from **node1** (or whichever node you used
```
Look closely and see that the image with **IMAGE ID** `4a415e366388` has two **REPOSITORY** tags.
3. Login to Docker Hub with your own Docker ID
3. Login to Docker Cloud with your own Docker ID
```
$ docker login
Login with your Docker ID to push and pull images from Docker Hub...
Login with your Docker ID to push and pull images from Docker Store...
Username: <your-docker-id>
Password:
Login Succeeded
```
4. Push the image to a new repository in your Docker Hub namespace. Remember to use the image tag you created earlier that includes your own Docker ID.
4. Push the image to a new repository in your Docker Cloud namespace. Remember to use the image tag you created earlier that includes your own Docker ID.
> NOTE: As part of this `push` operation you will be asked to enter two new keys:
- A new root key (this only happens the first time you push an image after enabling DCT)
@ -155,4 +155,4 @@ The following commands will clean-up the artifacts from this lab.
$ export DOCKER_CONTENT_TRUST=
```
4. Login to Docker Hub > Locate the repository you created with the `docker image push` command > Click Settings > Delete the repository.
4. Login to Docker Cloud > Locate the repository you created with the `docker image push` command > Click Settings > Delete the repository.

Просмотреть файл

@ -30,7 +30,7 @@ The most common and basic way to pull Docker iamges is by `tag`. The is where yo
$ sudo docker pull alpine:edge
```
This command will pull the Alpine image tagged as `edge`. The corresponding image can be found [here on Docker Hub](https://hub.docker.com/r/_/alpine/).
This command will pull the Alpine image tagged as `edge`. The corresponding image can be found [here on Docker Store](https://store.docker.com/images/alpine).
If no tag is specified, Docker will pull the image with the `latest` tag.

Просмотреть файл

@ -1,7 +1,7 @@
# Packaging ASP.NET Apps as Docker Images
A Docker image packages your application and all the dependencies it needs to run into one unit. Microsoft maintain the [microsoft/aspnet](https://hub.docker.com/r/microsoft/aspnet/) image on Docker Hub, which you can use as the basis for your own application images. It is based on [microsoft/windowsservercore](https://hub.docker.com/r/microsoft/windowsservercore/) and has IIS and ASP.NET already installed.
A Docker image packages your application and all the dependencies it needs to run into one unit. Microsoft maintain the [microsoft/aspnet](https://store.docker.com/images/aspnet) image on Docker Store, which you can use as the basis for your own application images. It is based on [microsoft/windowsservercore](https://store.docker.com/images/windowsservercore/) and has IIS and ASP.NET already installed.
In this lab I start with an MSI that deploys a web app onto a server and expects IIS and ASP.NET to be configured. If you already have a scripted build process then you may have MSIs or Web Deploy packages already being generated, and it's easy to package them into a Docker image.
@ -34,7 +34,7 @@ cd .\v1.0
docker build -t dockersamples/modernize-aspnet-ops:1.0 .
```
The output from `docker build` shows you the Docker engine executing all the steps in the Dockerfile. If you don't have a copy of Microsoft's ASP.NET image locally, then Docker starts by downloading it from Docker Hub.
The output from `docker build` shows you the Docker engine executing all the steps in the Dockerfile. If you don't have a copy of Microsoft's ASP.NET image locally, then Docker starts by downloading it from Docker Store.
When the build completes you'll have a new image stored locally, with the name `dockersamples/modernize-aspnet-ops` and the tag `1.0` indicating that this is version 1.0 of the app.

Просмотреть файл

@ -2,7 +2,7 @@
The Docker image from [Part 1](part-1.md) is a snapshot of the application, built with a specific version of the app and a specific version of Windows. When you have an upgrade to the app or an operating system update you don't make changes to the running container - you build a new Docker image which packages the updated components and replace the container with a new one.
Microsoft are releasing [monthly updates to the Windows base images](https://hub.docker.com/r/microsoft/windowsservercore/tags/) on Docker Hub. When your applications are running in Docker containers, there is no 'Patch Tuesday' with manual or semi-automated update processes. The Docker build process is fully automated, so when a new version of the base image is released with security patches, you just need to rebuild your own images and replace the running containers.
Microsoft are releasing [monthly updates to the Windows base images](https://store.docker.com/images/windowsservercore/plans/1e9acba1-c879-49b0-9109-7cfcf820a47a?tab=tags) on Docker Store. When your applications are running in Docker containers, there is no 'Patch Tuesday' with manual or semi-automated update processes. The Docker build process is fully automated, so when a new version of the base image is released with security patches, you just need to rebuild your own images and replace the running containers.
## Dockerfile for the v1.1 Application Image

Просмотреть файл

@ -1,7 +1,7 @@
# Modernize ASP.NET Apps Lab
You can run full .NET Framework apps in Docker using the [Windows Server Core](https://hub.docker.com/r/microsoft/windowsservercore/) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS](https://hub.docker.com/r/microsoft/iis/) and [ASP.NET](https://hub.docker.com/r/microsoft/aspnet/), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.
You can run full .NET Framework apps in Docker using the [Windows Server Core](https://store.docker.com/images/windowsservercore) base image from Microsoft. That image is a headless version of Windows Server 2016, so it has no UI but it has all the other roles and features available. Building on top of that there are also Microsoft images for [IIS]https://store.docker.com/images/iis) and [ASP.NET](https://store.docker.com/images/aspnet), which are already configured to run ASP.NET and ASP.NET 3.5 apps in IIS.
This lab steps through porting an ASP.NET WebForms app to run in a Docker container on Windows 10 or Windows Server 2016. With the app running in Docker, you can easily modernize it - and in the lab you'll add new features quickly and safely by making use of the Docker platform.

Просмотреть файл

@ -26,7 +26,7 @@ FROM microsoft/windowsservercore:10.0.14393.693
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
```
You start `FROM` the `microsoft/windowsservercore` base image, which is managed by Microsoft and is publicly available on Docker Hub. Using the tag `10.0.14393.693` tells Docker to use a specific version of the image, rather than the default `latest` version. That means the build is repeatable, so any time you build the image you should get the exact same output because the base image will always be the same. If you want to update to a newer base image (Microsoft release regular updates with security patches), you can change the tag and rebuild.
You start `FROM` the `microsoft/windowsservercore` base image, which is managed by Microsoft and is publicly available on Docker Store. Using the tag `10.0.14393.693` tells Docker to use a specific version of the image, rather than the default `latest` version. That means the build is repeatable, so any time you build the image you should get the exact same output because the base image will always be the same. If you want to update to a newer base image (Microsoft release regular updates with security patches), you can change the tag and rebuild.
The `SHELL` instruction tells Docker to switch to using PowerShell, so for the rest of the Dockerfile any commands are run using PowerShell. The shell is configured to fail if there are any errors, and to switch off progress bars for better performance. With this and the `escape` instruction you can use normal PowerShell syntax in the Dockerfile.
@ -63,7 +63,7 @@ From the `v1-src\docker\builder` directory, build the image using the normal `do
docker build -t dockersamples/modernize-aspnet-builder .
```
> The image is already built and available on Docker Hub as [dockersamples/modernize-aspnet-builder](https://hub.docker.com/r/dockersamples/modernize-aspnet-builder/) so you can run `docker pull dockersamples/modernize-aspnet-builder` to use that version rather than building it yourself.
> The image is already built and available on Docker Store as [dockersamples/modernize-aspnet-builder](https://store.docker.com/community/images/dockersamples/modernize-aspnet-builder) so you can run `docker pull dockersamples/modernize-aspnet-builder` to use that version rather than building it yourself.
With this image you can build any ASP.NET application, you just need to prepare a `docker run` command which mounts the host directories into the container and specifies the MSBuild script to run. The [build.ps1](v1-src/ProductLaunch/build.ps1) script for version 1 of the app is very simple, it just builds the web project from the expected source location, and publishes to the expected output location. Running from the `v1-src` directory, the command to build the ASP.NET project is:

Просмотреть файл

@ -23,7 +23,7 @@ FROM microsoft/windowsservercore:10.0.14393.693
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
```
In the `FROM` instruction you use the same version of the Windows Server Core base image that you used for the build agent. You could use [microsoft/iis](https://hub.docker.com/r/microsoft/iis/) instead, which builds on Server Core and adds IIS, or [microsoft/aspnet](https://hub.docker.com/r/microsoft/aspnet/) which builds on the IIS image and adds ASP.NET. Those images are also owned by Microsoft and follow the same release cadence as Windows Server Core, so when there's an OS update all those images have a new release. But it's easy to configure IIS and ASP.NET in the Dockerfile, so you can do it yourself and control what gets installed:
In the `FROM` instruction you use the same version of the Windows Server Core base image that you used for the build agent. You could use [microsoft/iis](https://store.docker.com/images/iis) instead, which builds on Server Core and adds IIS, or [microsoft/aspnet](https://store.docker.com/images/aspnet) which builds on the IIS image and adds ASP.NET. Those images are also owned by Microsoft and follow the same release cadence as Windows Server Core, so when there's an OS update all those images have a new release. But it's easy to configure IIS and ASP.NET in the Dockerfile, so you can do it yourself and control what gets installed:
```
RUN Add-WindowsFeature Web-server, NET-Framework-45-ASPNET, Web-Asp-Net45; `

Просмотреть файл

@ -8,7 +8,7 @@ For this lab, the sample application uses [Entity Framework Code-First](https://
## Running App Dependencies
Microsoft provide a SQL Server Express image for Windows on Docker Hub - [microsoft/mssql-server-windows-express](https://hub.docker.com/r/microsoft/mssql-server-windows-express/). [Express Edition](https://www.microsoft.com/en-us/sql-server/sql-server-editions-express) is suitable for non-production and small-scale production environments (the current limitation is 10GB of storage), and with Docker it's easy to run separate databases in SQL Server instances, as separate containers.
Microsoft provide a SQL Server Express image for Windows on Docker Store - [microsoft/mssql-server-windows-express](https://store.docker.com/images/mssql-server-windows-express). [Express Edition](https://www.microsoft.com/en-us/sql-server/sql-server-editions-express) is suitable for non-production and small-scale production environments (the current limitation is 10GB of storage), and with Docker it's easy to run separate databases in SQL Server instances, as separate containers.
To run SQL Server Express in Docker, you can start a container from Microsoft's image:
@ -81,7 +81,7 @@ That means the app is working correctly and storing the data in SQL Server.
## Part 3 - Recap
Now you've taken the .NET WebForms app and it's running in Docker. You have a version tag in the image name, and you could share the image on a public registry like [Docker Hub](https://hub.docker.com), or run your own [private registry in Docker](https://github.com/docker/labs/blob/master/windows/registry/README.md), or an enterprise-grade solution like [Docker Trusted Registry](https://docs.docker.com/datacenter/dtr/2.1/guides/). Anyone with access to the registry can pull the image and run the application, and it will behave in the exact same way.
Now you've taken the .NET WebForms app and it's running in Docker. You have a version tag in the image name, and you could share the image on a public registry like [Docker Store](https://store.docker.com), or run your own [private registry in Docker](https://github.com/docker/labs/blob/master/windows/registry/README.md), or an enterprise-grade solution like [Docker Trusted Registry](https://docs.docker.com/datacenter/dtr/2.1/guides/). Anyone with access to the registry can pull the image and run the application, and it will behave in the exact same way.
At this stage you need to communicate a dependency on SQL Server for the application, and it's still a manual step to start both the database and application containers. Later in the lab you'll see how to capture all the dependencies for a distributed solution, and automate the startup using [Docker Compose](https://docs.docker.com/compose/overview/).

Просмотреть файл

@ -38,7 +38,7 @@ var eventMessage = new ProspectSignedUpEvent
MessageQueue.Publish(eventMessage);
```
The `ProspectSignedUpEvent` object contains the original `Prospect` object, populated from the webform input. The `MessageQueue` class is just a wrapper to abstract the type of message queue. In this lab you'll be using [NATS](https://nats.io), a high-performance, low-latency, cross-platform and open-source message server. NATS is available as an [official image](https://hub.docker.com/_/nats/) on Docker Hub, which means it's a curated image that you can rely on for quality. Publishing a Message to NATS means multiple subscribers can listen for the event, and you start to bring [event-driven architecture](https://msdn.microsoft.com/en-us/library/dd129913.aspx) into the application - just for the one feature that needs it, without a full rewrite.
The `ProspectSignedUpEvent` object contains the original `Prospect` object, populated from the webform input. The `MessageQueue` class is just a wrapper to abstract the type of message queue. In this lab you'll be using [NATS](https://nats.io), a high-performance, low-latency, cross-platform and open-source message server. NATS is available as an [official image](https://store.docker.com/images/nats) on Docker Store, which means it's a curated image that you can rely on for quality. Publishing a Message to NATS means multiple subscribers can listen for the event, and you start to bring [event-driven architecture](https://msdn.microsoft.com/en-us/library/dd129913.aspx) into the application - just for the one feature that needs it, without a full rewrite.
## Changing App Configuration to use Environment Variables
@ -176,7 +176,7 @@ Country_CountryCode : USA
## Part 4 - Recap
Moving the web app to Docker gives you a modern, scalable and easily pluggable platform to modernize it. Containers running in the same Docker network can communicate with very little overhead, and with [Docker Hub](https://hub.docker.com) and [Docker Store](https://store.docker.com) there are thousands of ready-built, enterprise-grade, open-source applications which you can drop straight into your solution.
Moving the web app to Docker gives you a modern, scalable and easily pluggable platform to modernize it. Containers running in the same Docker network can communicate with very little overhead, and with [Docker Store](https://store.docker.com) there are thousands of ready-built, enterprise-grade, open-source applications which you can drop straight into your solution.
You made one of the app features asynchronous by pulling the functionality out of the website, and into a message handler, using the NATS message queue to plumb them together. [NATS](http://nats.io) is a very performant, high-quality messaging system which is perfect for microservice or event-driven architectures, and it can be added to a Dockerized solution with very little effort. Without Docker you would need to commission servers for the message queue and ensure it ran with the same level of high-availability as the web application. With Docker you run the queue and the app on the same cluster, and the whole solution has the same level of HA.

Просмотреть файл

@ -51,7 +51,7 @@ FROM microsoft/iis:windowsservercore-10.0.14393.693
COPY index.html c:/inetpub/wwwroot/index.html
```
The image uses the [microsoft/iis](https://hub.docker.com/r/microsoft/iis/) base image, which is itself based on Windows Server Core, with IIS installed and using the same ServiceMonitor tool. The only other instruction is to copy in the `index.html` file to a known location on the image, which is the content root for the default website in IIS.
The image uses the [microsoft/iis](https://store.docker.com/images/iis) base image, which is itself based on Windows Server Core, with IIS installed and using the same ServiceMonitor tool. The only other instruction is to copy in the `index.html` file to a known location on the image, which is the content root for the default website in IIS.
> The integration between the web app and the new homepage component is simplified in this example. Dependencies for the new content (stylesheets, scripts and images) would need to be publicly accessible. A better approach would be to use a reverse proxy as the entrypoint to the app, and define the routings in the proxy.
@ -128,7 +128,7 @@ In this lab you started with a monolothic ASP.NET WebForms app, and modernized i
- packaging a build agent as a Docker image, to build the app consistently on a laptop or a CI server without needing Visual Studio;
- packaging the WebForms app as a Docker image, so it runs in the same way on any Windows machine running Docker;
- extracting key features from the monolith into small services, encapsulated in separate Docker images;
- integrating enterprise-grade third party software from Docker Hub into the solution;
- integrating enterprise-grade third party software from Docker Store into the solution;
- capturing the full solution configuration in a runnable format using Docker Compose.
Taking a feature-driven approach to modernization gives you fast and quantifiable return on investment when you move your application to Docker. In the lab you took steps towards an event-driven architecture, and made use of a microservice approach to the UI, without an extensive re-write of the application. You've seen that the Docker platform enables app modernization, with a focus on business value and without a full re-architecture of the application.
@ -138,4 +138,4 @@ Taking a feature-driven approach to modernization gives you fast and quantifiabl
Moving your own .NET application to Docker is easy. You don't need to follow the full approach of this lab - if you already have a CI build for your app, you can package the current output into a Docker image, without needing to write a build agent. If you don't have a CI process, but you have the app running in a VM, you can use the [Image2Docker](https://blog.docker.com/2016/12/convert-asp-net-web-servers-docker-image2docker/) tool to extract a Dockerfile from the VM's disk for an ASP.NET app.
The Windows Server Core image is based on the full Windows Server 2016, and it should suitable for running any Windows app in Docker - provided the app and its dependencies can be installed and run without a Windows UI. ASP.NET 2.0 WebForms apps run fine in Docker, and you can use the [microsoft/aspnet:3.5](https://hub.docker.com/r/microsoft/aspnet/) image as the base if you need the 3.5 framework. Java, Go, NodeJS and PHP apps all run in Docker, so the platform has the power to host your whole application stack, and underpin your modernization roadmap.
The Windows Server Core image is based on the full Windows Server 2016, and it should suitable for running any Windows app in Docker - provided the app and its dependencies can be installed and run without a Windows UI. ASP.NET 2.0 WebForms apps run fine in Docker, and you can use the [microsoft/aspnet:3.5](https://store.docker.com/images/aspnet) image as the base if you need the 3.5 framework. Java, Go, NodeJS and PHP apps all run in Docker, so the platform has the power to host your whole application stack, and underpin your modernization roadmap.

Просмотреть файл

@ -1,6 +1,6 @@
# Registry Lab
A registry is a service for storing and accessing Docker images. [Docker Hub](https://hub.docker.com) and [Docker Store](https://store.docker.com) are the best-known hosted registries, which you can use to store public and private images. You can also run your own registry using the open-source [Docker Registry](https://docs.docker.com/registry), which is a Go application that can run in a Windows container.
A registry is a service for storing and accessing Docker images. [Docker Cloud](https://cloud.docker.com) and [Docker Store](https://store.docker.com) are the best-known hosted registries, which you can use to store public and private images. You can also run your own registry using the open-source [Docker Registry](https://docs.docker.com/registry), which is a Go application that can run in a Windows container.
## What You Will Learn
@ -14,7 +14,7 @@ You'll learn how to:
- generate encrypted passwords (using Docker!) and run an authenticated, secure local registry over HTTPS with basic auth.
> Note. The open-source registry does not have a Web UI, so there's no friendly interface like [Docker Hub](https://hub.docker.com) or [Docker Store](https://store.docker.com). Instead there is a [REST API](https://docs.docker.com/registry/spec/api/) you can use to query the registry. For a local registry which has a Web UI and role-based access control, Docker, Inc. has the [Trusted Registry](https://www.docker.com/sites/default/files/Docker%20Trusted%20Registry.pdf) product.
> Note. The open-source registry does not have a Web UI, so there's no friendly interface like [Docker Cloud](https://cloud.docker.com) or [Docker Store](https://store.docker.com). Instead there is a [REST API](https://docs.docker.com/registry/spec/api/) you can use to query the registry. For a local registry which has a Web UI and role-based access control, Docker, Inc. has the [Trusted Registry](https://www.docker.com/sites/default/files/Docker%20Trusted%20Registry.pdf) product.
### Prerequisites

Просмотреть файл

@ -1,6 +1,6 @@
# Part 1 - Building the Registry Image
Docker provides an [official registry image](https://hub.docker.com/_/registry/) on the Hub, but currently it is only available as a Linux image. The application is written in Go so it can be compiled for Windows and run as a container on Windows 10 and Windows Server 2016.
Docker provides an [official registry image](https://store.docker.com/images/registry) on the Hub, but currently it is only available as a Linux image. The application is written in Go so it can be compiled for Windows and run as a container on Windows 10 and Windows Server 2016.
> Note. Expect the official image to have a Windows variant soon, but this part of the lab is still useful if you want to build from the latest source code yourself.
@ -26,9 +26,9 @@ FROM sixeyed/golang:windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
```
The base image is [sixeyed/golang](https://hub.docker.com/r/sixeyed/golang/) which is on the Docker Hub, built from [this Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/golang/Dockerfile). It has the Go toolset installed, but rather than using a released version, it builds Go from the source on GitHub to get the latest features.
The base image is [sixeyed/golang](https://store.docker.com/community/images/sixeyed/golang) which is in the Docker Store, built from [this Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/golang/Dockerfile). It has the Go toolset installed, but rather than using a released version, it builds Go from the source on GitHub to get the latest features.
> Note. There is an [official Go image](https://hub.docker.com/_/golang/) on Docker Hub, which has Windows Server Core and Nano Server variants. That uses the latest release of Go - 1.7 - which has [an issue](https://github.com/golang/go/issues/15978) that stops you using Docker volumes on Windows. It's fixed in the latest source code, which is why we use an image that builds from source, but when Go 1.8 is released we can switch to using the official image as the base for the builder.
> Note. There is an [official Go image](https://store.docker.com/images/golang) on Docker Store, which has Windows Server Core and Nano Server variants. That uses the latest release of Go - 1.7 - which has [an issue](https://github.com/golang/go/issues/15978) that stops you using Docker volumes on Windows. It's fixed in the latest source code, which is why we use an image that builds from source, but when Go 1.8 is released we can switch to using the official image as the base for the builder.
There's a single `CMD` instruction to build the latest version of the registry and copy the built files to a known output location:
@ -42,7 +42,7 @@ When we run a container from the builder image, it will compile the latest regis
## Building the Registry Server
First we build the builder image - all the images in this lab use [microsoft/windowsservercore](https://hub.docker.com/r/microsoft/windowsservercore/) or [microsoft/nanoserver](https://hub.docker.com/r/microsoft/nanoserver/) as the base images, so you can only use a Windows host to build and run them. From a PowerShell session, navigate to the lab folder and build the builder:
First we build the builder image - all the images in this lab use [microsoft/windowsservercore](https://store.docker.com/images/windowsservercore) or [microsoft/nanoserver](https://store.docker.com/images/nanoserver) as the base images, so you can only use a Windows host to build and run them. From a PowerShell session, navigate to the lab folder and build the builder:
```PowerShell
docker build -t registry-builder -f Dockerfile.builder .

Просмотреть файл

@ -22,7 +22,7 @@ In my case, the container IP address is `172.24.194.96`, yours will be different
## Understanding Image Names
Typically we work with images from the Docker Hub, which is the default registry for the Docker Engine. Commands using just the image repository name work fine, like this:
Typically we work with images from the Docker Store, which is the default registry for the Docker Engine. Commands using just the image repository name work fine, like this:
```PowerShell
docker pull microsoft/nanoserver
@ -34,7 +34,7 @@ docker pull microsoft/nanoserver
- `microsoft/nanoserver` - the repository name, in this case in `{userName}/{imageName}` format;
- `latest` - the image tag.
If a tag isn't specified, then the default `latest` is used. If a registry hostname isn't specified then the default `docker.io` for Docker Hub is used. If you want to use images with any other registry, you need to explicitly specify the hostname - the default is always Docker Hub, you can't change to a different default registry.
If a tag isn't specified, then the default `latest` is used. If a registry hostname isn't specified then the default `docker.io` for Docker Store is used. If you want to use images with any other registry, you need to explicitly specify the hostname - the default is always Docker Store, you can't change to a different default registry.
With our local registry, the hostname is the IP address, and we also need to specify the custom port we're using. The full registry address is `172.24.194.96:5000`.
@ -68,13 +68,13 @@ Docker is running again now, so we can restart the registry container. When we s
docker start registry
```
The registry is running at the expected address, and we've configured Docker to allow access, so we can push and pull images to our local registry, just like we can with Docker Hub and Docker Store.
The registry is running at the expected address, and we've configured Docker to allow access, so we can push and pull images to our local registry, just like we can with Docker Cloud and Docker Store.
## Pushing and Pulling from the Local Registry
Docker uses the hostname from the full image name to determine which registry to use. We can buid images and include the local registry hostname in the image tag, or use the `docker tag` command to add a new tag to an existing image.
These commands pull a public image from Docker Hub, tag it for use in the private registry with the full name `172.24.194.96:5000/labs/hello-world:nanoserver`, and then push it to the registry:
These commands pull a public image from Docker Store, tag it for use in the private registry with the full name `172.24.194.96:5000/labs/hello-world:nanoserver`, and then push it to the registry:
```PowerShell
docker pull sixeyed/hello-world:nanoserver

Просмотреть файл

@ -14,7 +14,7 @@ openssl req \
[OpenSSL](https://www.openssl.org/) is a very popular TLS/SSL toolkit in Linux, but it's less common in Windows. There is a Windows build hosted at [indy.fulgan.com](https://indy.fulgan.com/SSL/), but rather than install it onto our Windows host to run a one-off command, we can use a Docker image with OpenSSL installed.
The [sixeyed/openssl](https://hub.docker.com/r/sixeyed/openssl/) image on Docker Hub is built from this [Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/openssl/Dockerfile), which just installs and configures OpenSSL on top of the Windows Nano Server base image.
The [sixeyed/openssl](https://store.docker.com/community/images/sixeyed/openssl) image on Docker Store is built from this [Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/openssl/Dockerfile), which just installs and configures OpenSSL on top of the Windows Nano Server base image.
We can use it to generate the SSL certificate for the registry with Docker:
@ -145,7 +145,7 @@ Digest: sha256:961497c5ca49dc217a6275d4d64b5e4681dd3b2712d94974b8ce4762675720b4
Status: Downloaded newer image for registry.local:5000/labs/hello-world:latest
```
In this case, the client machine already had one of the Windows Nano Server base layers (`5496a`), but it pulled an update layer from Docker Hub (`94b4c`), and it pulled the custom layer for my image from my own registry (`06162`).
In this case, the client machine already had one of the Windows Nano Server base layers (`5496a`), but it pulled an update layer from Docker Store (`94b4c`), and it pulled the custom layer for my image from my own registry (`06162`).
We can go one step further with the open-source registry server, and add basic authentication - so we can require users to securely log in to push and pull images.

Просмотреть файл

@ -6,7 +6,7 @@ From [Part 3](part-3.md) we have a registry running in a Docker container, which
The registry server and the Docker client support [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) over HTTPS. The server uses a file with a collection of usernames and encrypted passwords. The file uses a common standard from the Linux world - [Apache htpasswd](https://httpd.apache.org/docs/current/programs/htpasswd.html), but as usual we don't want to install Apache on our local machine to use one tool.
On the Docker Hub, the repository [sixeyed/httpd](https://hub.docker.com/r/sixeyed/httpd/) ([Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/httpd/Dockerfile)) is configured with Apache and the associated tools already installed. We can use that image to run `htpasswd` and generate the encrypted strings. These commands create a new `auth` subdirectory and a new `registry.htpasswd` file with one set of credentials:
On the Docker Store, the repository [sixeyed/httpd](https://store.docker.com/community/images/sixeyed/httpd) ([Dockerfile](https://github.com/sixeyed/dockers-windows/blob/master/httpd/Dockerfile)) is configured with Apache and the associated tools already installed. We can use that image to run `htpasswd` and generate the encrypted strings. These commands create a new `auth` subdirectory and a new `registry.htpasswd` file with one set of credentials:
```PowerShell
mkdir auth
@ -78,7 +78,7 @@ Using default tag: latest
Error response from daemon: Get https://registry.local:5000/v2/labs/hello-world/manifests/latest: no basic auth credentials
```
The result is the same for valid and invalid image names, so you can't even check a repository exists without authenticating. Logging in to the registry is the same `docker login` command you use for Docker Hub, specifying the registry hostname:
The result is the same for valid and invalid image names, so you can't even check a repository exists without authenticating. Logging in to the registry is the same `docker login` command you use for Docker Store, specifying the registry hostname:
```PowerShell
> docker login registry.local:5000
@ -103,12 +103,12 @@ Digest: sha256:961497c5ca49dc217a6275d4d64b5e4681dd3b2712d94974b8ce4762675720b4
Status: Image is up to date for registry.local:5000/labs/hello-world:latest
```
> Note. The open-source registry does not support the same authorization model as Docker Hub or Docker Trusted Registry. Once you are logged in to the registry, you can push and pull from any repository, there is no restriction to limit specific users to specific repositories.
> Note. The open-source registry does not support the same authorization model as Docker Store or Docker Trusted Registry. Once you are logged in to the registry, you can push and pull from any repository, there is no restriction to limit specific users to specific repositories.
## Conclusion
[Docker Registry](https://docs.docker.com/registry/) is a free, open-source application for storing and accessing Docker images. You can run the registry in a container on your own network, or in a virtual network in the cloud, to host private images with secure access. For Linux hosts, there is an [official registry image](https://hub.docker.com/_/registry/) on Docker Hub, but in this lab we saw how to build and run the registry from the lastest source code, in a Windows container.
[Docker Registry](https://docs.docker.com/registry/) is a free, open-source application for storing and accessing Docker images. You can run the registry in a container on your own network, or in a virtual network in the cloud, to host private images with secure access. For Linux hosts, there is an [official registry image](https://store.docker.com/images/registry) on Docker Store, but in this lab we saw how to build and run the registry from the lastest source code, in a Windows container.
We've covered all the options, from running an insecure registry, through adding SSL to encrypt traffic, and finally adding basic authentication to restrict access. By now you know how to set up a usable registry in your own environment, and you've also used some key Docker patterns - using containers as build agents and to run basic commands, without having to install software on your host machines.
There is still more you can do with Docker Registry - using a different [storage driver](https://docs.docker.com/registry/storage-drivers/) so the image data is saved to reliable share storage, and setting up your registry as a [caching proxy for Docker Hub](https://docs.docker.com/registry/recipes/mirror/) are good next steps.
There is still more you can do with Docker Registry - using a different [storage driver](https://docs.docker.com/registry/storage-drivers/) so the image data is saved to reliable share storage, and setting up your registry as a [caching proxy for Docker Store](https://docs.docker.com/registry/recipes/mirror/) are good next steps.

Просмотреть файл

@ -1,6 +1,6 @@
# SQL Server Lab
Microsoft have an image on Docker Hub which lets you run SQL Server Express 2016 as a container: [microsoft/mssql-server-windows-express](https://hub.docker.com/r/microsoft/mssql-server-windows-express/). That gives you a vanilla SQL Server instance where you can attach existing databases, but you need to have created the database outside of the container first. In this lab we'll build a Docker image which packages up a whole database schema, so when you run the container you have a fully-deployed database ready to use from your applications, or from SQL Server Management Studio.
Microsoft have an image on Docker Store which lets you run SQL Server Express 2016 as a container: [microsoft/mssql-server-windows-express](https://store.docker.com/images/mssql-server-windows-express). That gives you a vanilla SQL Server instance where you can attach existing databases, but you need to have created the database outside of the container first. In this lab we'll build a Docker image which packages up a whole database schema, so when you run the container you have a fully-deployed database ready to use from your applications, or from SQL Server Management Studio.
## What You Will Learn