adamkdean

software engineering

Get container ID from within container

By Adam K Dean on

To get the container ID from within a container, use this:

$ cat /proc/self/cgroup | grep "docker" | sed s/\\//\\n/g | tail -1

I'll probably stick it in an npm module at some point.