Skip to content

Commit 06e0f30

Browse files
committed
add section
1 parent cb3a2ec commit 06e0f30

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

articles/container-apps/container-debug-console.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,32 @@ tdnf install -y msopenjdk-17
159159

160160
---
161161

162+
## Scenarios to use Debug Console
163+
164+
- Accessing container's file system
165+
166+
You can access /proc/1 to access container's file system if you use **root** user to run your container.
167+
168+
If you use a non-root user, please run below command before accessing /proc/1 directory, or you will get permission denied error.
169+
170+
```bash
171+
app_gid=$(ps -ax --sort pid -o 'group' --no-headers | head -1)
172+
173+
if [ "$app_uid" != "$(whoami)" ]; then
174+
if [ -z "$(getent passwd $app_uid)" ]; then
175+
echo "User $app_uid does not exist. Creating..."
176+
groupadd -g $app_gid appgroup
177+
useradd -u $app_uid -g $app_gid appuser
178+
fi
179+
180+
echo "Switching to user $app_uid..."
181+
su appuser
182+
else
183+
echo "No need to switch user"
184+
fi
185+
```
186+
187+
---
188+
162189
> [!div class="nextstepaction"]
163190
> [View log streams from the Azure portal](log-streaming.md)

0 commit comments

Comments
 (0)