Comments (7)
Hi, @andreeaflorescu
Why is it a problem to run the container as root when it "is used by both automated systems (like Buildkite), but also by developers who want to test their code on their local machines"? And I haven't been able to connect the problem with the per-user Rust toolchain installation.
Do you mind explaining a bit more? :)
from rust-vmm-container.
One of the main pain points when running inside the container as root is that the build system leaves files on the disk with user root. To clean them up you need to be root (or the major hack that I did which was to run the container again just to clean the files). For example when running the container with Buildkite I would like to specify the user to be buildkite-agent so that the agent has permissions to remove any leftover files from previous runs. Same when running on a dev machine. I am not sure if this is possible, but that's what I had in mind.
from rust-vmm-container.
Other projects also have similar trouble. In Moby, their workaround is almost as same as your hack. They change the ownership of generated files: docker run --rm -v /home/ubuntu/workspace/moby_PR-40394:/workspace busybox chown -R 1000:1000 /workspace
Maybe we can do "chown" in a different way (assuming I am now in the folder of a rust-vmm component and want to start a container to build and test):
docker run --device=/dev/kvm -it --security-opt seccomp=unconfined --volume $(pwd):/workspace rustvmm/dev:v3 bash -c "bash ; chown -R $(id -u):$(id -g) /workspace/target"
(Add a HOOK to chown after the bash exits. The generated files belong to the user after the container exits.)
Does it help?
from rust-vmm-container.
This assumes that you use volumes to get the source code into the container and that you build the artefacts directly in the volume. I don't know buildkite but maybe it can be set up differently.
from rust-vmm-container.
@rn I think that is the default behavior of the docker plugin in Buildkite. What is the recommend way to do this?
from rust-vmm-container.
I've never used buildkite so can't really comment. I had a quick look at https://github.com/buildkite-plugins/docker-buildkite-plugin and one options might be perform the artefact build as part of a docker build
and extract the build result with a docker run -v
. Do you have example buildkite configs to look at?
from rust-vmm-container.
@rn rust-vmm-ci has the common buildkite pipeline we are using. We don't configure anything related to docker, we just specify what docker container we want to use for running the tests.
I was wondering what is the best practice when using containers so that you don't end up with files created by root.
from rust-vmm-container.
Related Issues (20)
- Add shell script linter to container image
- Update cargo-audit HOT 1
- Add pytest-timeout to container image
- install rust nightly HOT 1
- Downgrade rust version to one where the aarch64 musl target works
- Install pexect HOT 1
- Install boto3
- Create a script for managing Dockerfiles
- Create script for publishing new container versions HOT 2
- Create a buildkite pipeline that builds the container on each PR HOT 1
- Add script for building the Windows container
- Upgrade to Rust 1.51.1 HOT 1
- Upgrade to newer ubuntu for the base image
- Add tools to run bindgen HOT 1
- Fix docker.sh script - deprecated dockerhub API
- Add workflow for publishing containers versions HOT 1
- Re-add information about commit in docker build
- Cargo audit does not seem to be installed on arm anymore HOT 2
- Docker build workflow cannot be set as required
- Possible need of a Docker Hub repository to store container image for RISC-V CI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-vmm-container.