From bb666ef461a77232305320603edb412219eb1231 Mon Sep 17 00:00:00 2001 From: "saakla@amazon.com" Date: Tue, 22 Nov 2022 01:18:32 +0000 Subject: [PATCH] check domain join based on the gMSA support env --- ecs-init/docker/docker.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ecs-init/docker/docker.go b/ecs-init/docker/docker.go index d5065617e00..423e6ec063a 100644 --- a/ecs-init/docker/docker.go +++ b/ecs-init/docker/docker.go @@ -310,9 +310,13 @@ func (c *client) getContainerConfig(envVarsFromFiles map[string]string) *godocke envVariables[envKey] = envValue } - if isDomainJoined() { - // set the environment variable to true if the container instance is domain joined - envVariables["ECS_DOMAIN_JOINED_LINUX_INSTANCE"] = "true" + envVar := os.Getenv(config.ECSGMSASupportEnvVar) + // check for the domain join only if ECS_GMSA_SUPPORTED environment variable is set to true + if envVar == "true" { + if isDomainJoined() { + // set the environment variable to true if the container instance is domain joined + envVariables["ECS_DOMAIN_JOINED_LINUX_INSTANCE"] = "true" + } } for key, val := range envVarsFromFiles {