I am using vscode as an editor. Using vscode ctrl+shift+p to open up the command pallet and used "Dev Containers: Create Dev container" to create a development container, And it created only one file .devcontainer/devcontainer.json .
{
"name": "Debian",
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/docker-from-docker:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/guiyomh/features/golangci-lint:0": {}
}
}
But I would like to install few other packages like jinja2-cli after installation of python/pip3 package mentioned in the features or may be install other OS related packages.
Where should packages should be specified ?
Check that this line is included in your devcontainer.json
"postCreateCommand": "pip3 install --user -r requirements.txt",
Then create a requirements.txt file on the same level as you .devcontainer folder (not inside of it, outside).
If you add a package name to the requirements.txt file, it'll be added to the devcontainer at build time.
You can see an example in this pull request I recently completed which needed a new package and I had to add it to my devcontainer in the last commit.
Side note: You'll see that I also updated my poetry.lock file in a previous commit (using the poetry add package-name in the command line) because that project uses poetry for package management too. You don't need to do that if you aren't using poetry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With