binbashar / leverage

Binbash Leverage CLI intended to orchestrate Leverage Reference Architecture for AWS (www.binbash.co/leverage)
https://pypi.org/project/leverage/
Apache License 2.0
17 stars 2 forks source link

Enhancement | Run Toolbox as host user instead of root #193

Closed juanmatias closed 1 month ago

juanmatias commented 1 year ago

Describe the Enhancement

Based on this issue, about files created inside the Leverage Toolbox container not being owned by the user running Leverage CLI (aka the host user), the following proposal was raised.

Instead of having an extra step inside the container doing a chown when finishing the command, the container itself can be run as the host user, thus creating the files owned by it.

E.g.

docker run -it --rm -u ${UID}:${GID} -v $(pwd):/app --workdir /app binbash/leverage-toolbox:1.2.7-0.1.9 version

Plus, this will contribute to security, avoiding the use of root inside the container.

Expected Behavior

The user running inside the container should be the same as used on the host, then all the created files will be owned by it.

Use Case

n/a

Describe Ideal Solution

Run as mentioned before, the container using the host user.

Alternatives Considered

Use a previously configured user (at build time in Dockerfile) and the run a chown.

Additional Context

n/a

exequielrafaela commented 3 months ago

Ready to test: https://binbashar.slack.com/archives/GG0PJ78J3/p1722278060665079