MCPcopy Index your code
hub / github.com/coder/coder / wrapDockerExec

Function wrapDockerExec

agent/agentcontainers/containers_dockercli.go:207–214  ·  view source on GitHub ↗

wrapDockerExec is a helper function that wraps the given command and arguments with a docker exec command that runs as the given user in the given container. This is used to fetch information about a container prior to running the actual command.

(containerName, userName, cmd string, args ...string)

Source from the content-addressed store, hash-verified

205// container. This is used to fetch information about a container prior to
206// running the actual command.
207func wrapDockerExec(containerName, userName, cmd string, args ...string) (string, []string) {
208 dockerArgs := []string{"exec", "--interactive"}
209 if userName != "" {
210 dockerArgs = append(dockerArgs, "--user", userName)
211 }
212 dockerArgs = append(dockerArgs, containerName, cmd)
213 return "docker", append(dockerArgs, args...)
214}
215
216// Helper function to run a command and return its stdout and stderr.
217// We want to differentiate stdout and stderr instead of using CombinedOutput.

Callers 2

EnvInfoFunction · 0.85
TestWrapDockerExecFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestWrapDockerExecFunction · 0.68