How to show all shared memory allocated by docker

Viewed 1271

When I run a docker image with ipc=host and call shmget to allocate a shared memory in container, I can run ipcs -m to display this shared memory information on the host.

If I use the default ipc mode to run the docker image, I can run ipcs -m to display shared memory in docker, but I can not use the same method to display it on the host.

Is there any way to display all shared memory information allocated by docker container on the host,even if the ipc mode is not host?

2 Answers

You can use this to get information about each container from host:

sudo docker inspect <container-id> | grep Mem

example:

sudo docker inspect a1776a975e3a | grep Mem

Run you container with

docker exec -it containerName bash

This will open the terminal in the docker container, in terminal use

df -h | grep shm

Sample output enter image description here

Related