liveBook · Manning

Sidecar process

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A sidecar container is an additional co-located container that supports or monitors a primary container or its execution environment.

A sidecar container is an additional container co-located with a primary container in a Podman pod. It supports or monitors the application or its execution environment, while the primary container runs the application. section 4.1

The pod supplies shared execution context: containers join the infra container's Linux namespaces and cgroups, inherit pod volume mounts, and share its network namespace. A sidecar can therefore update files consumed by the primary container. section 4.2 section 4.3

Updating web content

Create a pod with a shared ./html:/var/www/html:z volume, add myapp as the primary container, and add a ubi8 container named time with --workdir /var/www/html. Run ./time.sh in the sidecar to rewrite index.html every second; myapp serves the changing timestamp on port 8080. section 4.2 section 4.3 section 4.4

Figure 4.4 Podman can launch additional containers called sidecar containers.

Use the process diagram to distinguish the primary application from additional sidecar containers launched into the pod. section 4.1

Use sidecars sparingly: multiple sidecars can consume additional resources and make a pod unwieldy. Starting or stopping the pod manages its infra, primary, and sidecar containers together. section 4.1 section 4.4

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains shared namespaces, cgroups, volumes, and a complete Podman creation and startup workflow.
Examples
Demonstrates a ubi8 sidecar rewriting shared HTML while a myapp web server serves the resulting timestamps.
What it assumes
Assumes basic containers and shell commands while establishing Podman pods, infra containers, namespaces, volumes, and SELinux labeling.
What you can do after
Apply it via Podman CLI to create, populate, start, and inspect a pod containing a primary container and sidecar.
How it connects
Connects sidecar containers with pods, primary containers, infra containers, Linux namespaces, cgroups, shared volumes, and SELinux labels.

Also explained in

Compare how 11 books explain sidecar process →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.