features/src/docker-from-docker
Chuck Lantz d1972b4d8d
Use _REMOTE_USER when available (#264)
* Use _REMOTE_USER when available

* Update src/python/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/python/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Fix java test issue - JDK 18 not available for the "open" distro

* Bump breakfix numbers

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
Co-authored-by: Josh Spicer <joshspicer@github.com>
2022-11-28 15:07:38 -08:00
..
devcontainer-feature.json Use _REMOTE_USER when available (#264) 2022-11-28 15:07:38 -08:00
install.sh Use _REMOTE_USER when available (#264) 2022-11-28 15:07:38 -08:00
NOTES.md Add missing notes 2022-11-02 18:39:11 -05:00
README.md Automated documentation update (#287) 2022-11-14 11:40:25 -08:00

Docker (Docker-from-Docker) (docker-from-docker)

Example Usage

"features": {
    "ghcr.io/devcontainers/features/docker-from-docker:1": {}
}

Options

Options Id Description Type Default Value
version Select or enter a Docker/Moby CLI version. (Availability can vary by OS version.) string latest
moby Install OSS Moby build instead of Docker CE boolean true
dockerDashComposeVersion Compose version to use for docker-compose (v1 or v2) string v1

Limitations

  • As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
  • The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
  • This approach does not currently enable bind mounting the workspace folder by default, and cannot support folders outside of the workspace folder. Consider whether the Docker-in-Docker Feature would better meet your needs given it does not have this limitation.

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). If you cannot use the Docker-in-Docker Feature, the only way to work around this is to use the host's folder paths instead of the container's paths.

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:

"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }

Then reference the env var when running Docker commands from the terminal inside the container.

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 in the VS Code Dev Containers extension (info).


Note: This file was auto-generated from the devcontainer-feature.json. Add additional notes to a NOTES.md.