1. Docker notes

1.1. /var/lib/docker on macOS

In macOS, docker commands (e.g., docker volume inspect) return references to /var/lib/docker, however this directory does not exist on the macOS host.

A way to check on it (ref. [dockernotes-01]):

> docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh

1.1.1. References

1.2. Determine the container using a docker volume

Ref. [dockernotes-02] :

docker ps -a --filter volume=VOLUME_NAME_OR_MOUNT_POINT
docker volume ls --filter name=container_name

1.2.1. References

1.3. Find the owner of a process running on a container without ps

Ref. [dockernotes-03] :

  • Simplest way seem to be using docker top command:

    > docker ps
    CONTAINER ID   IMAGE               COMMAND         CREATED        STATUS       PORTS                                       NAMES
    dfc7f2476fc9   contnotebook_docs   "/start-docs"   23 hours ago   Up 6 hours   0.0.0.0:7000->7000/tcp, :::7000->7000/tcp   contnotebook_docs
    
    > docker top dfc7
    UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
    root                18872               18844               0                   Aug04               ?                   00:00:00            /bin/bash /start-docs
    root                18982               18872               0                   Aug04               ?                   00:00:00            make livehtml
    root                18983               18982               1                   Aug04               ?                   00:03:15            /usr/local/bin/python /usr/local/bin/sphinx-autobuild -b html --host 0.0.0.0 --port 7000 -c . . _build/html
    
  • Another way: find the information relative to a process in /proc/PROCESS_ID/status

1.3.1. References