Skip to content

Commit 310dbac

Browse files
authored
Add description about UID/GID sync'ing (#54)
1 parent ea74ae0 commit 310dbac

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

docs/specs/devcontainer-reference.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ It is important to note that **image** and **dockerfile** properties are not nee
5757

5858
In addition to the configuration options explained above, there are other settings that apply when creating **development containers** to facilitate their use by developers.
5959

60-
We describe the main ones below.
60+
A complete list of available metadata properties and their purposes can be found in the [`devcontainer.json` reference](devcontainerjson-reference.md). However, we will describe the critical ones below in more detail.
6161

6262
## Environment Variables
6363

@@ -130,38 +130,43 @@ During this step, the following is executed:
130130

131131
The first part of environment creation is generating the final image(s) that the **development containers** are going to use. This step is orchestrator dependent and can consist of just pulling a Docker image, running Docker build, or docker-compose build. Additionally, this step is useful on its own since it permits the creation of intermediate images that can be uploaded and used by other users, thus cutting down on creation time. It is encouraged that tools implementing this specification give access to a command that just executes this step.
132132

133-
This step executes the following:
133+
This step executes the following tasks:
134134

135-
- [Configuration Validation](#configuration-validation)
136-
- Pull/build/execute of the defined container orchestration format to create images.
137-
- Validate the result of these operations.
135+
1. [Configuration Validation](#configuration-validation)
136+
2. Pull/build/execute of the defined container orchestration format to create images.
137+
3. Validate the result of these operations.
138138

139139
### Container Creation
140140

141141
After image creation, containers are created based on that image and setup.
142142

143-
This step executes the following:
143+
This step executes the following tasks:
144144

145-
- Create the container with the specified properties.
146-
- Validate the container(s) were created successfully.
145+
1. [Optional] Perform any required user UID/GID sync'ing (more next)
146+
2. Create the container(s) based on the properties specified above.
147+
3. Validate the container(s) were created successfully.
147148

148-
Note that container [mounts](#mounts), [environment variables](#environment-variables), and [user](#users) configuration should be applied at this point. However, remote user and environment variable configuration should not be.
149+
Note that container [mounts](#mounts), [environment variables](#environment-variables), and [user](#users) configuration should be applied at this point. However, remote user and environment variable configuration should **not** be.
150+
151+
UID/GID sync'ing is an optional task for Linux (only) and that executes if the `updateRemoteUserUID` property is set to true and a `containerUser` or `remoteUser` is specified. In this case, an image update should be made prior to creating the container to set the specified user's UID and GID to match the current local user’s UID/GID to avoid permission problems with bind mounts. Implementations **may** skip this task if they do not use bind mounts on Linux, or use a container engine that does this translation automatically.
149152

150153
### Post Container Creation
151154

152155
At the end of the container creation step, a set of commands are executed inside the **main** container:
153156
- `onCreateCommand`, `updateContentCommand` and `postCreateCommand`. This set of commands is executed in sequence on a container the first time it's created and depending on the creation parameters received. You can learn more in the [documentation on lifecycle scripts](devcontainerjson-reference.md#lifecycle-scripts). By default, `postCreateCommand` is executed in the background after reporting the successful creation of the development environment.
154-
- If the `waitFor` property is defined, then execution should stop at the specified property. This property defaults to `updateContentCommand`.
157+
- If the `waitFor` property is defined, then execution should block until all commands in the sequence up to the specified property have executed. This property defaults to `updateContentCommand`.
155158

156159
Remote [environment variables](#environment-variables) and [user](#users) configuration should be applied to all created processes in the container (inclusive of `userEnvProbe`).
157160

158161
### Implementation specific steps
159162

160-
After the all the steps executed in a succesful creation or restart, any implementation specific commands can safely execute. Specifically, any processes required by the implementation to support other properties in this specification should be started at this point.
163+
After these steps have been executed, any implementation specific commands can safely execute. Specifically, any processes required by the implementation to support other properties in this specification should be started at this point. These may occur in parallel to any non-blocking, background post-container creation commands (as dictated by the `waitFor` property).
161164

162165
Any user facing processes should have remote [environment variables](#environment-variables) and [user](#users) configuration applied (inclusive of `userEnvProbe`).
163166

164-
For example, in the CLI reference implementation, this is the point in which anything executed with `devcontainer exec` would run.
167+
For example, in the [CLI reference implementation](https://github.com/devcontainers/cli), this is the point in which anything executed with `devcontainer exec` would run.
168+
169+
Typically, this is also the step where implementors would apply config or settings from the `customizations` section of the dev container metadata (e.g., VS Code installs extensions based on the `customizations.vscode.extensions` property). Examples of these can be found in the [supporting tools section](supporting-tools.md) reference. However, applying these at this point is not strictly required or mandated by this specification.
165170

166171
Once these final steps have occurred, implementing tools or services may connect to the environment as they see fit.
167172

0 commit comments

Comments
 (0)