You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specs/devcontainer-reference.md
+17-12Lines changed: 17 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ It is important to note that **image** and **dockerfile** properties are not nee
57
57
58
58
In addition to the configuration options explained above, there are other settings that apply when creating **development containers** to facilitate their use by developers.
59
59
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.
61
61
62
62
## Environment Variables
63
63
@@ -130,38 +130,43 @@ During this step, the following is executed:
130
130
131
131
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.
2. Pull/build/execute of the defined container orchestration format to create images.
137
+
3. Validate the result of these operations.
138
138
139
139
### Container Creation
140
140
141
141
After image creation, containers are created based on that image and setup.
142
142
143
-
This step executes the following:
143
+
This step executes the following tasks:
144
144
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.
147
148
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.
149
152
150
153
### Post Container Creation
151
154
152
155
At the end of the container creation step, a set of commands are executed inside the **main** container:
153
156
-`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`.
155
158
156
159
Remote [environment variables](#environment-variables) and [user](#users) configuration should be applied to all created processes in the container (inclusive of `userEnvProbe`).
157
160
158
161
### Implementation specific steps
159
162
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).
161
164
162
165
Any user facing processes should have remote [environment variables](#environment-variables) and [user](#users) configuration applied (inclusive of `userEnvProbe`).
163
166
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.
165
170
166
171
Once these final steps have occurred, implementing tools or services may connect to the environment as they see fit.
0 commit comments