mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-11-03 11:48:17 +00:00
python3 is starting to become the default on all major distributions. Using `/usr/bin/python2` should be safe for the near future.
17 lines
246 B
Python
Executable File
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)
|
|
|
|
|
|
|