Skip to content

Commit 5870d2b

Browse files
authored
Merge pull request #1436 from choldgraf/root
Add note on root users and make postbuild actions more discoverable
2 parents 09b056e + 387155a commit 5870d2b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Run scripts, commands, and actions as part of environment building
2+
3+
In addition to installing packages using the [standard configuration files](#config-files), you can run your own custom actions and commands as part of the build or user session launch process.
4+
5+
(commands-jovyan)=
6+
7+
## Commands are run as the `jovyan` user and not root
8+
9+
Whenever you run a custom command, it is run as a special user called `jovyan`.
10+
It **does not have `root` privileges**.
11+
So, you should choose actions that do not require these privileges.
12+
13+
For example, if you're using a `postBuild` script to install and use a new environment manager like [the `pixi` CLI](https://pixi.sh/latest/), make sure to install and configure it to a location accessible (and writable) to a user. For example:
14+
15+
-`$CONDA_BIN` would work, because `conda` puts its binary folder in a user-accessible space.
16+
-`~/.local/bin` would work, because it's in the home directory.
17+
-`/usr/bin` would _NOT_ work, because it requires root privileges to write to.
18+
19+
## Run commands before finalizing your environment image
20+
21+
You can run arbitrary commands before finalizing your environment image.
22+
This is useful in cases like:
23+
24+
- You want to install and use custom environment management software that isn't supported by [repo2docker's configuration files](#config-files) (e.g., `pixi`).
25+
- You want to run custom commands to setup the environment properly (e.g., download a small dataset and put it in a specific location in the image).
26+
27+
To do so, use a `postBuild` script, see [](#postbuild) for more information.
28+
29+
## Run commands before launching a new user session
30+
31+
You can run commands before launching a new **user session**.
32+
These are not baked into the environment image, they'll only be run once an image has been launched, but before the user's interactive session has been created.
33+
34+
This is useful for things like:
35+
36+
- Start a local server running that you want a user to have access to.
37+
- Updating a local dataset that always needs to have the latest information in it.
38+
39+
To do so, use a `start` script. See [](#config-start) for more information.

docs/source/use/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ repository
2222
../howto/user_interface
2323
../howto/languages
2424
../howto/lab_workspaces
25+
./actions-and-scripts
2526
../howto/export_environment
2627
../howto/base_image
2728
```

0 commit comments

Comments
 (0)