aws / aws/amazon-ssm-agent

RunDockerAction should respect default CMD unless cmd parameter is not specified

Open
#254 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

Due to the line below, default `CMD` stated in Dockerfile is always overridden:

https://github.com/aws/amazon-ssm-agent/blob/master/agent/plugins/dockercontainer/dockercontainer.go#L192
```
commandArguments = append(commandArguments, pluginInput.Image)
commandArguments = append(commandArguments, pluginInput.Cmd)
```

Since `pluginInput.Cmd` is not a required parameter, this plugin should handle it like as other optional inputs, for example:

```
commandArguments = append(commandArguments, pluginInput.Image)
if len(pluginInput.Cmd) > 0 {
commandArguments = append(commandArguments, pluginInput.Cmd)
}
```

Otherwise, the customers always need to specify the same value as Dockerfile.

Contributor guide

Open the contributing guide

Research direction

Start in agent/plugins/dockercontainer/dockercontainer.go around line 192, where the Docker command arguments are assembled. Verify how an omitted Cmd affects the image's default Dockerfile CMD, and confirm that an explicitly provided Cmd still overrides it. Done means RunDockerAction preserves the default CMD when Cmd is empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.