Docker Enterprise 3.0 is the first Containers-as-a-Service platform that extends from the developer’s desktop to production. Docker Desktop Enterprise offers developers the ability to create container-based applications quickly and easily, even if they have little prior knowledge of Docker or Kubernetes. Developers on Windows 10 can create both Windows and Linux applications, and developers on macOS can create Linux applications with Docker Desktop Enterprise. Application Templates enable developers to build modern applications using a library of predefined and organization-approved application and service templates, without requiring prior knowledge of Docker commands. By providing re-usable “scaffolding” for developing modern container-based applications, Application Templates accelerate developer onboarding and improve productivity. Docker Enterprise is the first platform to support both Docker Swarm and Kubernetes orchestration which also extends to developer desktops with Docker Desktop Enterprise. Docker Desktop Enterprise includes the ability to ensure matching API versions through the use of Version Packs.
In this lab, we’ll use Docker Desktop Enterprise to create container-based applications locally. If you’re also running the Docker Enterprise workshop, you will have the opportunity to push these applications to the Docker Enterprise cluster using both Swarm and Kubernetes.
Suggested workshop order:
- Task 1 - Task XX in this workshop can be run as a standalone workshop using only Docker Desktop Enterprise.
- If running in conjunction with the Docker Enterprise workshop you can switch over and run Task 1 in that workshop to setup your Docker Enterprise environment.
- After completing Task 1 in the Docker Enterprise workshop you can return to this lab and complete Task XX - XX to push and deploy applications to your cluster.
System Requirements
You need Docker Desktop Enterprise installed on your laptop or workstation with internet access to complete this lab. An XX-day evaluation license is included with the download of Docker Desktop Enterprise.
- You will also need a code editor of your choice. Instructions here demonstrate the use of Microsoft Visual Studio Code (vscode), but any code editor should work.
- No knowledge of the code syntax is assumed.
- Some steps demonstrate the use of the Docker plugin in vscode; many code editors have Docker plugins available that should function similarly. The plugins are not required and the equivalent command will be given to complete the step.
- The Docker Desktop Enterprise download is approximately 1.8 GB so please download and install before the workshop
Windows OS Requirements
- Windows 10 Professional or Enterprices
- Hyper-V features enable. If you want to see how to enable Hyper-V, check it out over here..
- Download Docker Desktop Enterprise for Windows 10
- Windows 10 Pro or Enterprise
Mac OS Requirements
- Download Docker Desktop Enterprise for macOS
- macOS: Docker Desktop requires macOS 10.12 and newer
- Mac Hardware must be a 2010 or newer model
Difficulty: Intermediate (assumes basic familiarity with Docker) If you're looking for a basic introduction to Docker, check out https://training.play-with-docker.com
Time: Approximately XX minutes
Introduction:
Tasks:
- Deploying to Docker Enterprise Clusters
- These tasks should be completed after completing Task 1 in the Docker Enterprise workshop
- Task 4: Connecting to Docker Enterprise UCP and DTR
- Task 5: Push to DTR
- Task 6: Deploy App to UCP
-
When you encounter a phrase in between
<and>you are meant to substitute in a different value.For instance if you see
<your email>you would actually type something likemyemail@host.com
JIM TO UPDATE -- Docker Enterprise provides an integrated, tested and certified platform for apps running on enterprise Linux or Windows operating systems and Cloud providers. Docker Enterprise is tightly integrated to the the underlying infrastructure to provide a native, easy to install experience and an optimized Docker environment. Docker Certified Infrastructure, Containers and Plugins are exclusively available for Docker Enterprise with cooperative support from Docker and the Certified Technology Partner.
JIM TO PROVIDE
A Swarm is a group of machines that are running Docker and joined into a cluster. After that has happened, you continue to run the Docker commands you’re used to, but now they are executed on a cluster by a Swarm manager. The machines in a Swarm can be physical or virtual. After joining a Swarm, they are referred to as nodes.
Swarm mode uses managers and workers to run your applications. Managers run the Swarm cluster, making sure nodes can communicate with each other, allocate applications to different nodes, and handle a variety of other tasks in the cluster. Workers are there to provide extra capacity to your applications.
With Docker Desktop Enterprise, you have a single Docker node. Because it is a single node, Swarm mode is not enabled by default, however, Swarm mode can be enabled if required to test commands or features which are only available in Swarm mode. These commands or features include docker stack deploy or the docker service commands.
In a multi-node clustered environment, Swarm mode uses managers and workers to run your applications. Managers run the swarm cluster, making sure nodes can communicate with each other, allocating applications to different nodes, and handling a variety of other tasks in the cluster. Workers are there to provide the capacity for your applications. If you are completing the Docker Enterprise workshop along with these exercises you will have a remote cluster with one manager and three workers and later tasks will have you push images and deploy applications from your Docker Desktop Enterprise to the remote cluster.
Kubernetes is part of Docker Enterprise 3.0 in both Docker Desktop Enterprise and Docker Enterprise referred to as Docker Kubernetes Service or DKS. Kubernetes deployments tend to be more complex than Docker Swarm, and there are many additional component types within Kubernetes. The Universal Control Plane (UCP) in Docker Enterprise clusters simplifies much of the complexities using Kubernetes. The Docker platform includes a fully-comformant Kubernetes Distribution. We'll concentrate on Pods and Load Balancers in this workshop, but there's plenty more supported by UCP 2.XX.
Docker Desktop Enterprise installation comes pre-configured with administration tools. The admin settings enable administrators to configure Docker Desktop for developer teams and we'll explore some of the administration settings in this section.
The first time you launch Docker Desktop Enterpirse it will prompt you for a license file. You can install the license file directly through the prompt or manually based on your Operating System
Mac
Install the Docker Desktop Enterprise (DDE) license file at the following location:
/Library/Group Containers/group.com.docker/docker_subscription.lic
Windows
Install the Docker Desktop Enterprise (DDE) license file at the following location for Windows users:
%ProgramData%\DockerDesktop\docker_subscription.lic
System administrators can configure Docker Desktop Enterprise (DDE) settings, specify and lock configuration parameters to create a standardized development environment based on the developers operating systems.
- Show admin-settings.json (lockable settings)
- Windows location:
\%ProgramData%\DockerDesktop\admin-settings.jsonwhich defaults toC:\ProgramData\DockerDesktop\admin-settings.json.
NOTE: You need Administrator privelages to edit this file - Mac location:
/Library/Application\ Support/Docker/DockerDesktop
- Windows location:
The admin-settings.json allows the configuration of DDE settings. Each configuration can be configured with a default value and whether this value is locked for users or not. The configurations include:
proxyallow users to change the proxy settingsfilesharingDirectoriesWhich directories are shared with Docker DesktopCPUnumber of CPU coresmemoryMibamount of memory allocated to Docker DesktopdataFolderWhere Docker stores datediskSizeMibamount of disk space allocated to Docker Desktop of for images, volumes, etcswamMibamount of swamp memory for Docker Desktopkubernetesenable KubernetesshowSystemContainersShows containers running in the background
- Navigate to the
admin-settings.jsonlocation based on your Operating System. See above for the location for Mac or Windows. - Using your favorite editor, open the
admin-settings.jsonfile and review the available configurations.
The dockerdesktop-admin tool allows System Administators to manage DDE applications version packs from the command line.
Mac
- Show dockerdesktop-admin tool
- Mac location:
/Applications/Docker.app/Contents/Resources/bin sudo ./dockerdesktop-admin --helpsudo ./dockerdesktop-admin app uninstallto remove DDE and VPs (do not run!)
- Mac location:
- Install a Version Pack with dockerdesktop-admin tool
sudo ./dockerdesktop-admin version-pack install <path to ddvp>- Note that Desktop needs to be stopped to add a Version Pack
Windows
- Show dockerdesktop-admin tool
- Windows location:
[ApplicationPath]\dockerdesktop-admin.exe
- Windows location:
- Install a Version Pack with dockerdesktop-admin tool
dockerdesktop-admin.exe -InstallVersionPack=['path-to-archive']
- Version-pack uninstall with dockerdesktop-admin tool
dockerdesktop-admin.exe -UninstallVersionPack=[version-pack-name|'path-to-archive']- NOTE: You must stop Docker Desktop before installing a version pack.
Enabling Kubernetes in Docker Desktop only requires a single click.
NOTE: Offline mode is supported when enabling Kubernetes in Docker Desktop Enterprise.
- Open Docker Desktop Enterprise -> Settings
- Switch to the Kubernetes Tab
- Check the
Enable Kubernetesbox - Click Apply. This will take a couple minutes depending on the performance of your computer
Mac
Windows
- Run the Kubernetes Cluster creation in the background and will be ready once the Kubernetes status turns green
Mac
Windows
Congratulations! Docker Desktop Enterprise is now ready to deploy applications to use either Swarm or Kubernetes.
Jim can you provide more background what you need here?
By default, Docker Desktop uses Build.XX. Buildkit is not required for any exercises in this workshop but we will go ahead and enable it so you can see it in action in case you want to explore advanced build actions on your own.
- Right Click
Docker Desktop Enterprise->Settings - Open the
DeamonTab - Switch to the
Advanced TabThis is the Docker Daemon configuration filedaemon.json - Delete the existing configuration
- Copy and paste the
daemon.jsonconfiguration below
Jim Windows app doesn't have Daemon > advanced tab. Do we need to split this out as a seperate Windows section [marcel]?
{
"debug" : true,
"experimental" : false,
"features": { "buildkit": true }
}- Click the
Apply & Restartbutton
Docker Desktop Enterprise is now running with Buildkit enabled.
In this section, we will explore the capabilities of the DDE Application Designer. The Application Designer comes with a librbary of pre-configured application templates. The Apllication Designer is a visual designer enabling developers to create Docker based applications.
Next, we will explore the Application Designer and learn how to design a new application. When we create a new application we are provided the choice to use a template which contains preconfigured applications or define a custom applications.
- Reight Click on
Docker Desktop->Design new application
-
Select
Choose Template -
Choose the
Flask/ NGINX / MYSQL application
Customize the default settings of the Flask/ NGINX / MYSQL application template
-
Remove port
8080from Flask and leave blank as we don't want the backend to communicate directly to the internet. -
Change the port of the NGINX Proxy from port
80-->8081so now the NGINX proxy is handeling routing of traffic to the backend service.
The scaffoloding of the template copies all the necessary Dockerfiles, docker-compose, and application specific files locally to DDE. Once all the files have been copied locally, DDE then builds the images and prepares them for use.
-
Name the Application
-
Change the
locationof Scaffolded project, if required. -
Click
Scaffold -
Open
Show Logsto view the log output fromdocker-composestarting the application stack in the foreground allowing us to view all the logs for each contianer in the stack.
Once the Scaffold has complete we have the option to Run Application
- Click
Run Application
The log output displays docker-compose starting the application stack in the foreground allowing us to view all the logs for each contianer.
In this section we will add a custom template repository allowing us to import our own custom application templates. Our demo application is a Link Extractor application containing a PHP Frontend and an API written in Python. Next, we will make some live coding changes to the running application, customize the application by upgrading the Docker images, and finally deploy our application to Kubernetes.
It is also possible to add a custom template repository to DDE. The library.yaml file defines the plugins and application dependencies required for the new template.
The Docker Desktop Enterprise Application Designer is configured with a standard library of Application templates. We will add an additional custom library for this hands on lab. The library configuration is defined in the preferences.yaml file. Here we define where the Desktop Designer will fetch the library.yaml files from.
Using your favorite text editor edit preferences.yaml. The library configuration can be found at:
Mac/Linux
/Users/<user>/.docker/application-template/preferences.yaml
Windows
C:\Users\<user>\.docker\application-template\preferences.yaml
Add a new repository, which is shown below the library repository as the custom-services repository with a URL pointing to the DDE Lab GitHub Repo. The file should look like this when you're done:
apiVersion: v1alpha1
disableFeedback: true
kind: Preferences
repositories:
- name: library
url: https://docker-application-template.s3.amazonaws.com/production/v0.1.5/library.yaml
- name: custom-services
url: https://raw.githubusercontent.com/JimCodified/dde-handsonlab/master/labsetup/appdesignertemplates/library.yaml
Next, the custom-services template will now be avaialble when we open Application Designer and Choose a template
-
Right Click on
Docker Desktop->Design new application -
Select
Choose Template -
Choose the
Flask/ Apache application
The scaffoloding of the template copies all the necessary Dockerfiles, docker-compose, and application specific files locally to DDE. Once all the files have been copied locally, DDE then builds the images and prepares them for use.
-
Name the Application
links-app -
Change the
locationof Scaffolded project, if desired. -
Click
Scaffold -
Open
Show Logsto view the log output fromdocker-composestarting the application stack in the foreground allowing us to view all the logs for each contianer in the stack.
Once the Scaffold has complete we have the option to Run Application
- Click
Run Application
Inside the links-app project we can see the live log output from our application stack. We also have the possability to Stop or Restart our application stack.
- Open the
links-appin a browser tab http://localhost - Test the
links-appby providing a full URLhttps://www.docker.com - Click
Extract Linksbutton - Let's test the API as well. Open a new Browser tab. Copy and paste
http://localhost:5000/which returns the usage of the API - Provide a query to the API. Copy and paste
http://localhost:5000/api/https://docker.comwhich displayes the same results from the the UI but inJSONformat.
Now, we will make changes to our running Links application. The Application Designer comes with the included feature to launch Visual Studio Code (VS Code) directly in the project directory or Open Windows Explorer or Finder on Mac and edit the files directly with another editor. In this example, we will use Visual Studio Code
- Click the
Open in Visual Studio Codewhich now opens thelinks-appin VS Code. - Navigate and open
www/index.php - Change the HTML Color on line #61 & #62 from
#082E41to#007bffand save theindex.php
div.header {
background: #007bff;
margin: 0;
}
div.footer {
background: #007bff;
margin: 0;
padding: 5px;
}- Return to your Browser Tab running http://localhost and refresh the page. You should now see the
links-apphas been rebranded with Docker colors.
We can also customize the Application Stack. In this task, we will upgrade the links-app images to the newest version.
- Click the
Open in Visual Studio Codewhich now opens thelinks-appin VS Code. - Open the
docker-compose.ymlfile in the root of thelinks-appdirectory - Update Docker images for both
apiandwwwservices which should match the below
version: "3.6"
services:
api:
build: api
image: ollypom/ee-templates-api:step4-v1
ports:
- 5000:5000
www:
environment:
- API_ENDPOINT=http://api:5000/api/
image: ollypom/ee-templates-web:step4-v1
ports:
- 80:80
volumes:
- ./www/web:/var/www/html- Save the
docker-compose.ymlfile - Inside
Application DesignerclickRestartwhich will rebuild thelinks-appusing the updated images. - Open your browser tab http://localhost and refresh and verify the
links-appis still running
Cleanup Let's cleanup our enviornemnt in preperation for the next task.
- Inside
Application DesignerclickStopwhich stop ourlinks-appapplication usingdocker-compose
Our application runs inside Application Designer using docker-compose. In this section, we will re-use the same docker-compose file, Python & PHP files, and the same project directory to start our links-app using Kubernetes which we enabled earlier in task 1.3. Without making any further changes we will now deploy the links-app with DDE Kubernetes.
First, we need to prepare our enviornments.
- Within
Application DesignerclickOpen in Visual Studio Codewhich will open thelinks-appproject in VS Code. - Next, open a terminal inside VS Code. From the VS Code menu
Terminal->New Terminal - Set the default Orchestrator to Kubernetes
Mac
export DOCKER_STACK_ORCHESTRATOR=kubernetesWindows
set DOCKER_STACK_ORCHESTRATOR=kubernetesNext, we will deploy the links-app to Kubernetes running inside our DDE environment.
- Deploy the
links-appto Kubernetes
docker stack deploy -c docker-compose.yaml links-app
- Verify the deployment was successful and in the terminal run:
kubectl get services
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
api ClusterIP None <none> 55555/TCP 3m31s
api-published LoadBalancer 10.102.157.172 localhost 5000:32662/TCP 3m31s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 18d
www ClusterIP None <none> 55555/TCP 3m31s
www-published LoadBalancer 10.102.165.196 localhost 80:32291/TCP 3m31s- Notice that
www-publishedis mapped tolocalhost:80andapi-publishedis mapped tolocalhost:5000just as we saw previously inApplication Designer - Open a new Browser Tab for
www-publishedhttp://localhost - Open another Browser Tab for
api-publishedfor http://localhost:5000/api/https://docker.com
Congruatulations! In this section you have successfully added a custom repository, built and deployed the links-app application with Application Designer, performed live code changes to make the links-app Docker blue, and finally we deployed the same application in Kubernetes.
In this lab we've looked how Docker Enterprise can help you manage both Linux and Windows workloads whether they be traditional apps you've modernized or newer cloud-native apps, leveraging Swarm or Kubernetes for orchestration.
You can find more information on Docker Enterprise at http://www.docker.com as well as continue exploring using our hosted trial at https://dockertrial.com










