Docker Desktop Extension for Telepresence

Fast Feedback for Dev and Testing

With the announcement of Docker Desktop extensions, a whole new world of possibilities opened up with the standard Docker workflow and toolchain. Telepresence, a CNCF tool that enables fast local-to-remote dev and test loops, was one of the first extensions to be implemented and used by developers.

Every developer wants to create faster feedback loops when coding and verifying new functionality, and with the new Docker Desktop Extension for Telepresence, this is now much easier to do!

Why use the Docker Desktop Extension for Telepresence?

Two things that developers love are (1) a consistent workflow for their code, ship, and run cycles, and (2) a short time for feedback. A Docker Desktop-based workflow gives you the first of these, and Telepresence provides the second.

Docker Desktop allows you to easily build container images from Dockerfiles or using other related tooling like CNCF Buildpacks. Docker Desktop also enables a UI-driven workflow for you to run container images with ports mapped and local volumes mounted. It is easy to spin up a small collection of networked applications running within containers using Docker Compose, modify one of these applications, and then build and push the resulting image to Docker Hub. You can then deploy this image into your Kubernetes cluster and begin testing.

Although Docker makes the build and push part of this workflow easy, this process still takes time, particularly if you have a large container image or a slow Internet connection. Telepresence provides a two-way proxy between your local machine and a remote Kubernetes cluster that enables you to interact with applications and services running in the cluster rapidly.

Imagine working on a service on your local dev machine with several resource-intensive dependencies running in a remote cluster, and you want to run an integration test. Instead of coding, building the container, and then pushing this container to a remote registry in order to run your integration test, with Telepresence you can simply make the code change, connect into your remote cluster via the Docker Desktop extension for Telepresence UI, and run the test. Even if you’re testing against the remote entry point for your application (such as a web page or public UI), Telepresence can intercept and reroute traffic from your remote cluster to the service running on your local machine.

How does the Docker Extension for Telepresence work?

Telepresence users have been “Running Telepresence inside a container” for some time. The Docker Desktop Extension for Telepresence makes this easier and more accessible, particularly for developers that prefer using a desktop UI rather than the command-line interface.

Telepresence for Docker runs entirely within containers. The Telepresence Daemons run in a container, which can be given commands using the extension UI. When Telepresence intercepts a service, it redirects cloud traffic to other containers on the Docker host network.

Telepresence for Docker is isolated from a user's (your) host machine; it operates entirely within the Docker runtime. Therefore, Telepresence for Docker does not require root permission on your dev machine.

Telepresence for Docker is configured to use Docker's host network (VM network for Windows and Mac, host network on Linux). Typically, Docker containers are isolated from each other, but they can be configured to share a network. This is most commonly achieved by appending the command line flag “--network host” to any Docker run commands.

Telepresence for Docker also needs to be able to redirect traffic from your container back into your remote Kubernetes cluster and the cloud. This is done by mounting Telepresence's network device into your container, which will do exactly that.

Increasing Your Testing Speed with Docker Desktop Extension for Telepresence

Testing your microservices-based application becomes problematic when it can no longer be run locally due to resource requirements. Moving to the cloud for testing is a no-brainer, but how do you synchronize your local changes against your remote Kubernetes environment? Even with Docker Desktop making the container build-push-test cycle easy, this still takes time and introduces wasteful context switches for you as an engineer.

Docker & Telepresence

By using the Docker Desktop Extension for Telepresence, you get flexible remote development environments that work with your Docker toolchain so that you can code and test faster for Kubernetes-based apps.

Traditional Way

  1. Code: Make changes to your app locally via IDE
  2. Build: Create container with code change: docker build
  3. Push: docker push
  4. Pause: wait for remote upload to remote registry
  5. Deploy: kubectl apply -f manifest.yaml (wait)
  6. Verify: Run tests against the staging cluster URL
  7. View: kubectl logs xyz -f
  8. Repeat: Identify new issue/bug and start this cycle again

Telepresence + Docker Way

  1. Code: Make changes to your app locally via IDE
  2. Build: Create container with code change: docker build
  3. Connect: Join your container’s network to the remote cluster: (push button)
  4. Verify: Use the auto-generated preview URL to view changes and run tests
  5. View: Access application logs locally via Docker Desktop UI or CLI e.g. docker logs
  6. Flow: Identify new issue/bug and begin fixing and verifying without repeating all the above steps

Additional resources