Files
OpenNetworkLinux/docker/tools/container-id
Andreas Rammhold a4cefaf8f5 tools: use /usr/bin/python2 instead of /usr/bin/python
python3 is starting to become the default on all major distributions.
Using `/usr/bin/python2` should be safe for the near future.
2017-06-30 11:40:29 +02:00

17 lines
246 B
Python
Executable File

#!/usr/bin/python2
# -*- python -*-
import re
import sys
for line in open('/proc/self/cgroup').readlines():
m = re.search(r'docker-(?P<id>[0-9a-f]{64})', line)
if m:
print m.group('id')[0:12]
sys.exit(0)
sys.exit(1)