MCPcopy
hub / github.com/docker/compose / copyFileToContainer

Method copyFileToContainer

pkg/compose/secrets.go:125–137  ·  view source on GitHub ↗
(ctx context.Context, id, content string, file types.FileReferenceConfig)

Source from the content-addressed store, hash-verified

123}
124
125func (s *composeService) copyFileToContainer(ctx context.Context, id, content string, file types.FileReferenceConfig) error {
126 b, err := createTar(content, file)
127 if err != nil {
128 return err
129 }
130
131 _, err = s.apiClient().CopyToContainer(ctx, id, client.CopyToContainerOptions{
132 DestinationPath: "/",
133 Content: &b,
134 CopyUIDGID: file.UID != "" || file.GID != "",
135 })
136 return err
137}
138
139func createTar(env string, config types.FileReferenceConfig) (bytes.Buffer, error) {
140 value := []byte(env)

Callers 1

injectFileReferencesMethod · 0.95

Calls 3

apiClientMethod · 0.95
createTarFunction · 0.85
CopyToContainerMethod · 0.45

Tested by

no test coverage detected