Useful Docker Commands

To see memory and CPU usage for all containers:
docker stats

b. To see disk usage for all containers:
docker ps -s

c. To see memory usage for all containers:
docker stats --no-stream --format "{{.Name}}: {{.MemUsage}}"

d. To see which container has been hit by the OOM killer:
for each in $(docker ps --format "{{.Names}}"); do if docker inspect --format '{{.State.OOMKilled}}' $each | grep -q 'true'; then echo "$each is OOMKilled"; fi; done

e. To copy a new nginx.conf into the nginx container:
Backup:
docker cp ollama_nginx:/etc/nginx/nginx.conf ./nginx.conf.bak
Copy local file into ollama_nginx container:
docker cp /home/vicki/Zuar/AI_Ollama_Server/nginx.conf ollama_nginx:/etc/nginx/nginx.conf
Check nginx.conf:
docker exec -it nginx nginx -t
Reload nginx config:
docker exec -it nginx nginx -s reload

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux. Bookmark the permalink.