Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable configs.file's on remote docker hosts #11871

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andoks
Copy link

@andoks andoks commented May 31, 2024

What I did
Copy configs.file's instead of bind-mounting them to make it possible to use file configs when working with remote docker hosts (like setting DOCKER_HOST to a ssh address or setting docker context)

Related issue

implements: #11867

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

pkg/compose/secrets.go Outdated Show resolved Hide resolved
pkg/compose/secrets.go Outdated Show resolved Hide resolved
Copy configs.file's and secrets.file's instead of bind-mounting them to
make it possible to use file configs when working with remote docker
hosts (like setting DOCKER_HOST to a ssh address or setting docker
context)

Includes support for config.files and secrets.files as directories.

Note that file.Content as source of secrets is denied elsewhere with the
error "validating docker-compose.yml: secrets.content_secret Additional
property content is not allowed"

implements: docker#11867
@andoks andoks force-pushed the topic/andoks/#11867-support-configs-files-on-remote-docker-hosts branch from 6638c2f to d9dd161 Compare June 1, 2024 12:26
file := project.Secrets[config.Source]
var tarArchive bytes.Buffer
var err error
switch {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: not handling file.Content as this seems to be rejected some other place, causing the printout "validating docker-compose.yml: secrets.content_secret Additional property content is not allowed"

}

func makeTarFileEntryParams(config types.FileReferenceConfig) (mode int64, uid, gid int, err error) {
mode = 0o444
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ should the default mode be different for secrets compared to configs?

err = fs.WalkDir(subdir, ".", func(filePath string, d fs.DirEntry, err error) error {
header := &tar.Header{
Name: filepath.Join(config.Target, filePath),
Mode: mode,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Should directories have the same mode as files? Or should they perhaps have the exec bit set for the owner/group/other to access them?

@andoks
Copy link
Author

andoks commented Jun 1, 2024

@ndeloof left you a few questions in the review

@alexey-sh
Copy link

any ETA?

@andoks
Copy link
Author

andoks commented Jun 15, 2024

@alexey-sh

any ETA?

See discussion in #11867 - it might take some time to decide how to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants