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: README.md
+31-2Lines changed: 31 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ To see which running devcontainers the CLI detects you can run the `list` comman
38
38
39
39
#### Running commands inside a devcontainer
40
40
41
-
`devcontainer` allows you to run commands in devcontainers. This is similar to `docker exec` but works with devcontainer names (rather than requiring container names/IDs).
41
+
`devcontainer` allows you to run commands in devcontainers. This is similar to `docker exec` but works with devcontainer names (rather than requiring container names/IDs).
42
42
43
43
For example:
44
44
@@ -74,7 +74,7 @@ Update to include the path to the `containers` folder in the `vscode-dev-contain
74
74
}
75
75
```
76
76
77
-
TODO: Add docs on the folder structure for adding custom templates
77
+
See [Template Paths](#template-paths) for more details of the structure of template folders.
78
78
79
79
#### Listing templates
80
80
@@ -101,3 +101,32 @@ As with `template add`, run this from the folder you want to add the devcontaine
101
101
# Symlink to the go template
102
102
devcontainer template add-link go
103
103
```
104
+
105
+
## Template paths
106
+
107
+
`devcontainer` can be [configured to scan multiple folders](#working-with-devcontainer-templates) to find templates. It is designed to work with folders structured in the same was as the [containers from in github.com/microsoft/vscode-dev-containers](https://github.com/microsoft/vscode-dev-containers/tree/master/containers).
108
+
109
+
Assuming you cloned [github.com/microsoft/vscode-dev-containers/](https://github.com/microsoft/vscode-dev-containers/) into your `~/source/` folder and set up a custom devcontainer folder in `~/source/devcontainers` then you can configure your template paths as shown below. The sub-folder names are used as the template name and when duplicates are found the first matching folder is taken, so in the example below the `~/source/devcontainers` templates take precedence.
110
+
111
+
```json
112
+
{
113
+
"templatepaths": [
114
+
"$HOME/source/devcontainers",
115
+
"$HOME/source/vscode-dev-containers/containers"
116
+
]
117
+
}
118
+
```
119
+
120
+
The structure for these template paths is shown in the following tree structure:
121
+
122
+
```misc
123
+
template-collection-folder
124
+
|-template1
125
+
| |-.devcontainer
126
+
| | |-devcontainer.json
127
+
| | |-Dockerfile
128
+
| | |-<other content for the template>
129
+
|-misc-folder
130
+
|-<misc content that is ignored as there is no .devcontainer folder>
0 commit comments