Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd options to runsc spec command #2554
Open
Comments
|
I was wondering if I could work on this issue? At first, I am planning to include the options mentioned above. Maybe later will extend it to other OCI options. |
geethanjalieswaran
added a commit
to geethanjalieswaran/gvisor
that referenced
this issue
May 25, 2020
Ref: google#2554
copybara-service bot
pushed a commit
that referenced
this issue
May 29, 2020
This adds the `cwd` option to the `run spec` command, as asked in #2554. Since this option is simple and straightforward, I only added a simple formatting rule when retrieving the spec template. I do realize this is not "maintainable" as we add more options, so there are some points that I'd like to raise: 1. I didn't see a lot of tests for cmd files, should I add one for the spec file? If so, any kind of template or good practices I should follow? 2. Other options asked in #2554 are a little more complex since the difference between the default and specified options aren't trivial. I was thinking of creating a full struct specification for OCI configuration files (following [this](https://github.com/opencontainers/runtime-spec/blob/master/config.md)). Any opinions on that matter? * [x] Have you followed the guidelines in [CONTRIBUTING.md](../blob/master/CONTRIBUTING.md)? * [x] Have you formatted and linted your code? * [ ] Have you added relevant tests? * [x] Have you added appropriate Fixes & Updates references? * [ ] If yes, please erase all these lines! --- ## Results ``` $ runsc spec --help spec [options] - create a new OCI bundle specification file. The spec command creates a new specification file (config.json) for a new OCI bundle. The specification file is a starter file that runs the "sh" command in the container. You should edit the file to suit your needs. You can find out more about the format of the specification file by visiting the OCI runtime spec repository: https://github.com/opencontainers/runtime-spec/ EXAMPLE: $ mkdir -p bundle/rootfs $ cd bundle $ runsc spec $ docker export $(docker create hello-world) | tar -xf - -C rootfs $ sed -i 's;"sh";"/hello";' config.json $ sudo runsc run hello -bundle string path to the root of the OCI bundle (default ".") -cwd string working directory that will be set for the executable, this value MUST be an absolute path (default "/") ``` ``` $ runsc spec -cwd "/custom/dir" $ cat config.json { "ociVersion": "1.0.0", "process": { "terminal": true, "user": { "uid": 0, "gid": 0 }, "args": [ "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/custom/dir", "capabilities": { [...] ``` FUTURE_COPYBARA_INTEGRATE_REVIEW=#2767 from mikaelmello:add-cwd-option-spec 9e8000e PiperOrigin-RevId: 313815101
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some documentation could be improved by adding some options to
runsc specto allow users to specify the command and some other common OCI options. This could also improve the getting started experience for folks who are kicking the tires with runsc.I'm thinking of the following options: