diff --git a/knowledge base/kubernetes/get the environment of a process running in a container.md b/knowledge base/get the environment of processes running in containers.md similarity index 70% rename from knowledge base/kubernetes/get the environment of a process running in a container.md rename to knowledge base/get the environment of processes running in containers.md index ef0646e..476f888 100644 --- a/knowledge base/kubernetes/get the environment of a process running in a container.md +++ b/knowledge base/get the environment of processes running in containers.md @@ -1,4 +1,4 @@ -# Get the environment of a process running in a container +# Get the environment of processes running in containers ## Table of contents @@ -9,13 +9,14 @@ ## TL;DR ```sh -cat /proc/${PID}/environ +# From a shell inside the container. +cat "/proc/${PID}/environ" -# Container in kubernetes. -kubectl exec pod-name -- cat /proc/1/environ +# In Kubernetes. +kubectl exec 'pod-name' -- cat '/proc/1/environ' -# Only works if the onboard `ps` is not from busybox. -ps e -p $PID +# This only works if the onboard `ps` is **not** the one from Busybox. +ps e -p "$PID" ``` ## Further readings