/dev-containers

Default dev container configs for quickly adding dev container support to a new project.

Primary LanguageDockerfileMIT LicenseMIT

dev-containers

Default dev container configs for quickly adding dev container support to a new project.

Available features

https://containers.dev/features

Add with:

"features": {
  "<feature_goes_here>": {
    "version": "latest"
  }
}

.env configuration

Add the following to your devcontainer.json file:

// Set the environment variables
"runArgs": ["--env-file",".env"],

Or if you're using docker-compose, add the following under app::

env_file:
  - ../.env

This will use the .env file in your project root for importing env variables.

mounting a local folder

For example, to map ~/linux on the host to /linux/kernel on the container:

// Mount ~/linux to /linux/kernel
"mounts": [
  "source=${localEnv:HOME}${localEnv:USERPROFILE}/linux,target=/linux/kernel,type=bind,consistency=cached"
],

Or map from the project root:

"mounts": [
  "source=${localWorkspaceFolder}/.config/.wrangler,target=/home/node/.config/.wrangler,type=bind,consistency=cached"
],

Install an apt dependency

Some applications may require a dependency such as imagemagick. Add the following to the Dockerfile, replacing imagemagick with your required dependencies:

RUN apt-get update && apt-get install -y imagemagick