Most developers find installing Docker fairly straight forward. You download the EXE or DMG for your environment and go through an intuitive installation process. But what you have there is typically a Docker Desktop Community Edition (CE). Desktop editions are great for individual developers but Docker has lot more to offer to enterprises who want to run containers at scale. Docker Enterprise provides many capabilities to schedule and manage your container workloads and also offers a private docker image repository. The challenge though is while it’s fairly easy to install Docker Desktop it isn’t quite the same to install Docker Enterprise. Docker Enterprise invariably requires installing Docker Enterprise Engine, installing Universal Control Plane (UCP) with multiple manager and worker nodes, Docker Trusted Registry (DTR) – a private image repo (similar to public Docker Hub), and other components.
In this post, I am going to simplify the setup for you by creating a single node sandbox environment for Docker Enterprise. Hope you will find it useful for your POCs and test use cases. For setup all you will need is a single node VM. You can use any of the public cloud platforms to spin up that single node. For this post, I have setup a Red Hat Enterprise Linux (RHEL) m4.xlarge (4 vCPU & 16GB Mem) instance on AWS. Please note the key components of Docker EE including UCP & DTR only run on Linux platforms. You can install additional Windows nodes later as workers to run Windows workloads.
STEP 1: Install Docker Enterprise Engine
To begin you would have to sign up for free 1 month trial for Docker EE. Once you create docker hub account and fill out the contact details required for trial you should get the below screen.
Copy the storebits URL and navigate to it in your browser. Here you will find packages for different OS versions. Now RDP into your EC2 instance. Add the relevant docker repo to your yum config manager. I will use RHEL since that’s the OS of my EC2 instance.
$ sudo -E yum-config-manager --add-repo "storebitsurl/rhel/docker-ee.repo"
Then install the docker EE engine, CLI & containerd packages.
$ sudo yum -y install docker-ee docker-ee-cli containerd.io
STEP 2: Install UCP (Universal Control Plane)
UCP is the heart of Docker Enterprise. It allows for running containers at scale, across multiple nodes, let’s you choose an orchestrator, provides RBAC enabled web UI for operations, and much more. The UCP installer runs through ‘ucp’ container image installing ucp agent which in turn bootstraps services and containers required by UCP.
docker container run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock `#mount docker sock` \
docker/ucp install `#ucp image is stored on docker hub` \
--host-address 172.31.6.154 `#private IP of your node` \
--san 18.104.22.168 `#public IP of your node` \
--admin-password YourPassword `#set the default password` \
--force-minimums `#for cases where node configuration is less than ideal`
Upon completion you should be able to browse your public IP (https://22.214.171.124) and access UCP UI shown below. To login use the ‘admin’ username and password ‘YourPassword’.
STEP 3: Install DTR (Docker Trusted Registry)
DTR installation takes a similar route to UCP. It uses a container image ‘dtr’ with install command.
docker run -it --rm docker/dtr install \
--ucp-node yourNodeName `#try docker node ls to retrive name` \
--ucp-username admin \
--ucp-url https://126.96.36.199 \
--ucp-insecure-tls `#ignore cert errors for self signed UCP certs` \
--replica-http-port 8080 `#choose a port other than 80 to avoid conflict with UCP` \
--replica-https-port 8843 `#choose a port other than 443 to avoid conflict with UCP` \
--dtr-external-url https://188.8.131.52:8843 `#this will add the external IP to DTR self-signed cert`
Once the command completes successfully you should be able to browse DTR UI on https port (https://184.108.40.206:8843).
STEP 4: Deploy an App
Let’s deploy an app to Docker EE. For this I would pull an ASP.NET sample image, create a org and repo in DTR, tag image for DTR repo and upload it. Post upload we can use docker stack to deploy the application. To begin let’s create an organization and repository in our DTR.
Now let’s pull the image from Docker Hub, Tag it and Push it to DTR.
docker pull mcr.microsoft.com/dotnet/core/samples:aspnetapp docker tag mcr.microsoft.com/dotnet/core/samples:aspnetapp 220.127.116.11:8843/brkthroo/dotnet:aspnetapp docker image push 18.104.22.168:8843/brkthroo/dotnet:aspnetapp
Next create a docker-compose.yml file with below instructions.
version: "3" services: web: # replace username/repo:tag with your name and image details image: 22.214.171.124:8843/brkthroo/dotnet:aspnetapp deploy: replicas: 1 restart_policy: condition: on-failure resources: limits: cpus: "0.1" memory: 50M ports: - "3776:80"
Once file is created run the docker stack deploy command to deploy listed services.
docker stack deploy -c docker-compose.yml aspnetapp
You should be able to browse app with node’s public IP on port 3776; in my case http://126.96.36.199:3776/.
In future, we will dig into more Docker EE features but hope this single node setup provided you a jumpstart in exploring Docker Enterprise.
Happy Learning 🙂 !