Skip to content

Commit b5e4b3c

Browse files
committed
Add note on root
1 parent 6cf91e4 commit b5e4b3c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Run scripts, commands, and actions as part of environment building
2+
3+
In addition to installing using [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+
## Commands are run as the `jovyan` user and not root
7+
8+
Whenever you run a custom command, it is run as a special user called `jovyan`.
9+
It **does not have `root` privileges**.
10+
So, you should choose actions that do not require these privileges.
11+
12+
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:
13+
14+
-`$CONDA_BIN` would work, because `conda` puts its binary folder in a user-accessible space.
15+
-`~/.local/bin` would work, because it's in the home directory.
16+
-`/usr/bin` would *NOT* work, because it requires root privileges to write to.
17+
18+
## Run commands before finalizing your environment image
19+
20+
You can run arbitrary commands before finalizing your environment image.
21+
This is useful in cases like:
22+
23+
- You want to install and use custom environment management software that isn't supported by [repo2docker's configuration files](#config-files) (e.g., `pixi`).
24+
- 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).
25+
26+
To do so, use a `postBuild` script, see [](#postbuild) for more information.
27+
28+
## Run commands before launching a new user session
29+
30+
You can run commands before launching a new **user session**.
31+
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.
32+
33+
This is useful for things like:
34+
35+
- Start a local server running that you want a user to have access to.
36+
- Updating a local dataset that always needs to have the latest information in it.
37+
38+
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)