Skip to content

Commit e16bdb5

Browse files
authored
Merge pull request #15 from stuartleeks/sl/docs
Add template folder docs
2 parents 73eac92 + 3f3d7ce commit e16bdb5

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To see which running devcontainers the CLI detects you can run the `list` comman
3838

3939
#### Running commands inside a devcontainer
4040

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).
4242

4343
For example:
4444

@@ -74,7 +74,7 @@ Update to include the path to the `containers` folder in the `vscode-dev-contain
7474
}
7575
```
7676

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.
7878

7979
#### Listing templates
8080

@@ -101,3 +101,32 @@ As with `template add`, run this from the folder you want to add the devcontaine
101101
# Symlink to the go template
102102
devcontainer template add-link go
103103
```
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>
131+
|-<README or other files that are ignore>
132+
```

0 commit comments

Comments
 (0)