diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index 2bc312cd22..634078c9a0 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -186,17 +186,8 @@ def is_host(): Test whether current process is running on the host or an docker return True for host and False for docker """ - try: - proc = subprocess.Popen(["docker", "--version"], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - universal_newlines=True) - stdout = proc.communicate()[0] - proc.wait() - result = stdout.rstrip('\n') - return result != '' - except OSError as e: - return False + docker_env_file = '/.dockerenv' + return os.path.exists(docker_env_file) is False def default_return(return_value, log_func=logger.log_debug):