Docker is a popular open-source platform for developing, shipping, and running applications inside containers. It allows for consistent deployment and scaling of applications, regardless of the underlying infrastructure. The OpenTelemetry demo project (https://github.com/open-telemetry/opentelemetry-demo/) uses Docker for deployment. Here are the steps to build and push Docker images using the Makefile function in this project.
- Prerequisites:
- Docker
- Docker Compose v2.0.0+
- Make (optional)
- 6 GB of RAM for the application
- Get and run the demo:
- Clone the Demo repository:
git clone https://github.com/open-telemetry/opentelemetry-demo.git
- Change to the demo folder:
cd opentelemetry-demo/
- Use make to start the demo:
make start
- Alternatively, you can use
docker compose up --force-recreate --remove-orphans --detach 1
- Dockerfile:
- The Dockerfile for the demo project is located in the root directory.
- It uses the
open-telemetry/opentelemetry-demo
base image and installs necessary dependencies. - The entrypoint script runs the demo application.
- Docker Compose:
- The
docker-compose.yml
file is used to define and run multi-container Docker applications. - It includes services for the demo application, OpenTelemetry Collector, Jaeger, and Grafana.
- Building and pushing Docker images:
- The Makefile in the project includes a
build-image
target to build the Docker image. - To build the image, run
make build-image
. - To push the image to a Docker registry, tag the image with the registry name and push it using
docker push
.
Example:
To push the Docker image to Docker Hub:
- Tag the image:
docker tag opentelemetry-demo <your-dockerhub-username>/opentelemetry-demo
- Push the image:
docker push <your-dockerhub-username>/opentelemetry-demo
Sources:
- https://opentelemetry.io/docs/demo/docker-deployment
- https://opentelemetry.io/blog/2022/debug-otel-with-otel
- https://opentelemetry.io/blog/2022/apisix
- https://opentelemetry.io/blog/2022/instrument-nginx
- https://opentelemetry.io/docs/instrumentation/js/resources
- https://opentelemetry.io/docs/demo/development
- https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/opentelemetry
- https://opentelemetry.io/blog/2022/instrument-apache-httpd-server
- https://opentelemetry.io/docs/instrumentation/python/getting-started
- https://opentelemetry.io/docs/collector/getting-started
- https://opentelemetry.io/docs/demo