Instead of grepping for 'lxc' in /proc/1/cgroup, use systemd's
features. This now at least also works in LXD containers.
Change-Id: I35e807c26f0b1fbba83ddbe04cfb4901a7a95cbe
| ... | ... |
@@ -666,7 +666,7 @@ function set_mtu {
|
| 666 | 666 |
|
| 667 | 667 |
# running_in_container - Returns true otherwise false |
| 668 | 668 |
function running_in_container {
|
| 669 |
- if grep -q lxc /proc/1/cgroup; then |
|
| 669 |
+ if [[ $(systemd-detect-virt --container) == 'none' ]]; then |
|
| 670 | 670 |
return 0 |
| 671 | 671 |
fi |
| 672 | 672 |
|