• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Linux ⚡️ 3 useful Docker commands

dEEpEst

☣☣ In The Depths ☣☣
Staff member
Administrator
Super Moderator
Hacker
Specter
Crawler
Shadow
Joined
Mar 29, 2018
Messages
13,861
Solutions
4
Reputation
32
Reaction score
45,552
Points
1,813
Credits
55,350
‎7 Years of Service‎
 
56%
⚡3 useful Docker commands:

1️⃣ docker diff <container> — shows changes in the container file system relative to the image. The command will be useful for auditing changes or finding problems after launch.
Example:

Bash:
docker diff my_container
# Output: A /tmp/new_file (file added)
# D /var/log/old.log (file deleted)




2️⃣ docker stats --format — custom output of resource statistics.
Example (CPU/memory monitoring in machine-readable format):
Bash:
docker stats --format "{{.Container}}: {{.CPUPerc}} | {{.MemUsage}}"


3️⃣ docker exec --user — run commands in a container as another user.
⚠️ IMPORTANT: Avoid root access where possible.
Example:
Bash:
docker exec --user app_user my_container whoami
 
Back
Top