Join us on July 18th for a webinar on CI/CD Pipeline Optimization with APIs & K8s. Register now

Telepresence for Docker

Fast development and testing feedback with Telepresence for Docker

Why use Telepresence for Docker Extension?

Two things that developers love are (1) a consistent development workflow, and (2) fast 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 rapidly and use local tools with applications and services running in the cluster.

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, Telepresence lets you make the code change, connect with your remote cluster via the Docker Desktop extension for Telepresence UI, and run the test. Even if you are 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 Telepresence for Docker work?

Telepresence users have been “running Telepresence inside a container” for some time. Telepresence for Docker 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 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 route traffic from your container back into your remote Kubernetes cluster and the cloud. This is done by mounting Telepresence's network device in your container, which will do exactly that.

Increasing Your Testing Speed

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 with 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 Telepresence for Docker Ex, you get flexible remote development environments that work with your Docker toolchain so that you can develop 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

Telepresence for Docker Compose

What is it?
  • Telepresence for Docker Compose
    Telepresence for Docker Compose seamlessly bridges the gap between Docker Compose and Kubernetes. Debug and iterate on your multi-container Docker applications locally while tapping into services running in your remote Kubernetes clusters.
How it works?
  • Next Steps
    Dive into a truly integrated environment where Docker Compose's simplicity meets Kubernetes' scalability and resilience. With Telepresence for Docker Compose, you're not just developing; you're pioneering the future of cloud-native workflows.

Experience fast dev and testing feedback with Telepresence for Docker