Skip to content

Conversation

bblommers
Copy link
Contributor

Motivation

Adds a utility method to create a file in the docker container, by just passing the content of the file. I find myself reusing the same approach quite often, so IMO it would be much nicer to have it available as a utility.

Permissions

When running this inside a container, the file will be created by the root user. If the target container runs it's process as a custom (non-root) user, it may not have access to files created by root.

The additional chmod_mode argument can be used to ensure the file is available to the custom user. (We could presumably also chown the file to the same effect, but I only used chmod so far to make files available in this scenario.)

@bblommers bblommers added area: docker Use Docker with LocalStack semver: patch Non-breaking changes which can be included in patch releases labels Jan 10, 2025
@bblommers bblommers added this to the Playground milestone Jan 10, 2025
@bblommers bblommers force-pushed the docker-create-file-in-container branch from 2357648 to 1cd6500 Compare January 10, 2025 13:40
Copy link

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 51m 40s ⏱️ +33s
3 949 tests ±0  3 640 ✅ ±0  309 💤 ±0  0 ❌ ±0 
3 951 runs  ±0  3 640 ✅ ±0  311 💤 ±0  0 ❌ ±0 

Results for commit 1cd6500. ± Comparison against base commit 630b2a1.

Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

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

LGTM!

@bblommers bblommers merged commit 0f081fb into master Jan 13, 2025
31 checks passed
@bblommers bblommers deleted the docker-create-file-in-container branch January 13, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docker Use Docker with LocalStack semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants