Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future / proposed spec changes #56

Merged
merged 13 commits into from
Nov 2, 2022
10 changes: 10 additions & 0 deletions _implementors/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ The options property contains a map of option IDs and their related configuratio
| `optionId.description` | string | Description for the option. |
{: .table .table-bordered .table-responsive}

### <a href="#user-env-var" name="user-env-var" class="anchor"> User environment variables </a>

Feature scripts run as the `root` user and sometimes need to know which user account the dev container will be used with.

`_REMOTE_USER` and `_CONTAINER_USER` environment variables are passsed to the Features scripts with `_CONTAINER_USER` being the container's user and `_REMOTE_USER` being the configured `remoteUser`. If no `remoteUser` is configured, `_REMOTE_USER` is set to the same value as `_CONTAINER_USER`.

Additionally, the home folders of the two users are passed to the Feature scripts as `_REMOTE_USER_HOME` and `_CONTAINER_USER_HOME` environment variables.

The container user can be set with `containerUser` in the devcontainer.json and image metadata, `user` in the docker-compose.yml, `USER` in the Dockerfile, and can be passed down from the base image.

## <a href="#devcontainer-json-properties" name="devcontainer-json-properties" class="anchor"> devcontainer.json properties </a>

Features are referenced in a user's [`devcontainer.json`](../json_reference) under the top level `features` object.
Expand Down
21 changes: 21 additions & 0 deletions _implementors/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,27 @@ To resume the environment from a stopped state:

Like during the create process, remote [environment variables](#environment-variables) and [user](#users) configuration should be applied to all created processes in the container (inclusive of `userEnvProbe`).

## <a href="#parallel-exec" name="parallel-exec" class="anchor"> Parallel lifecycle script execution (proposal) </a>

Dev containers support a single command for each of its lifecycle scripts. While serial execution of multiple commands can be achieved with `;`, `&&`, etc., parallel execution deserves first-class support.

All lifecycle scripts have been extended to support `object` types. The key of the `object` will be a unique name for the command and the value will be the `string` or `array` command. Each command must exit successfully for the stage to be considered successful.

Each entry in the `object` will be run in parallel during that lifecycle step.

### Example

```json
{
"postCreateCommand": {
"server": "npm start",
"db": ["mysql", "-u", "root", "-p", "my database"]
}
}
```

You may review this proposal directly in [the spec](https://github.com/devcontainers/spec/blob/main/proposals/parallel-lifecycle-script-execution.md).

# <a href="#definitions" name="definitions" class="anchor"> Definitions </a>
#### <a href="#project-workspace-folder" name="project-workspace-folder" class="anchor"> Project Workspace Folder </a>

Expand Down