Default dev container configs for quickly adding dev container support to a new project.
https://containers.dev/features
Add with:
"features": {
"<feature_goes_here>": {
"version": "latest"
}
}
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.
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"
],
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