aboutsummaryrefslogtreecommitdiff
path: root/src/docker-from-docker
diff options
context:
space:
mode:
authorChuck Lantz <clantz@microsoft.com>2022-08-11 23:11:00 +0300
committerGitHub <noreply@github.com>2022-08-11 23:11:00 +0300
commit29e25a77b03c0c8d34c612a74adffb2362af2bff (patch)
tree79ac107a58ba980e03a8dd869c4fc57406fd6aee /src/docker-from-docker
parentf8396a6c3531a3a307f5f9d1d3adf065baa7a5a6 (diff)
Add notes for Features that have them (#88)
Co-authored-by: Brigit Murtaugh <brigit.murtaugh@microsoft.com>
Diffstat (limited to 'src/docker-from-docker')
-rw-r--r--src/docker-from-docker/NOTES.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/docker-from-docker/NOTES.md b/src/docker-from-docker/NOTES.md
new file mode 100644
index 0000000..86cdd40
--- /dev/null
+++ b/src/docker-from-docker/NOTES.md
@@ -0,0 +1,27 @@
+## Supporting bind mounts from the workspace folder
+
+A common question that comes up is how you can use `bind` mounts from the Docker CLI from within the a dev container using this Feature (e.g. via `-v`). The trick is that, since you're actually using the Docker engine sitting outside of the container, the filesystem paths will be different than those in the container. You need to use the **host**'s paths instead.
+
+> **Note:** The docker-from-docker approach does not currently enable bind mounting locations outside of the workspace folder.
+
+### GitHub Codespaces
+
+In GitHub Codespaces, the workspace folder should work with bind mounts by default, so no further action is required.
+
+### Remote - Containers
+
+A simple way to do this is to put `${localWorkspaceFolder}` in an environment variable that you then use when doing bind mounts inside the container.
+
+Add the following to `devcontainer.json`:
+
+```json
+"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }
+```
+
+Then reference the env var when running Docker commands from the terminal inside the container.
+
+```bash
+docker run -it --rm -v ${LOCAL_WORKSPACE_FOLDER}:/workspace debian bash
+```
+
+> **Note:** There is no `${localWorkspaceFolder}` when using the **Clone Repository in Container Volume** command ([info](https://github.com/microsoft/vscode-remote-release/issues/6160#issuecomment-1014701007)). \ No newline at end of file