Improve container detection logic for edit-config. (#16825)

This commit is contained in:
Austin S. Hemmelgarn 2024-01-22 10:32:41 -05:00 committed by GitHub
parent 675cbbf24a
commit fc7f7be302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -112,8 +112,10 @@ check_editor() {
running_in_container() {
[ -e /.dockerenv ] && return 0
[ -e /.dockerinit ] && return 0
[ -r /proc/1/environ ] && tr '\000' '\n' </proc/1/environ | grep -Eiq '^container=podman' && return 0
[ -e /run/.containerenv ] && return 0
[ -r /proc/1/environ ] && tr '\000' '\n' </proc/1/environ | grep -Eiq 'container=' && return 0
grep -qF -e /docker/ -e /libpod- /proc/self/cgroup 2>/dev/null && return 0
return 1
}
get_docker_command() {