Is there a way to debug the PostCreateCommand in VSCode Devcontainers?
I think that one cause may be that the user does not have enough permissions to even execute the apt-get update
command.
Changing the remoteUser
to root
, in the devcontainer.json
configuration file should allow to execute the postCreateCommand.sh
shell script successfully when running it using bash
.
I've tried it using the
python:3.8-slim-buster
Docker image, having set anon-root
user in theDockerfile
.I've added the following to the
./.devcontainer/devcontainer.json
:"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh","remoteUser": "root",
I've used the following
./.devcontainer/postCreateCommand.sh
:#!/usr/bin/env bashset -exapt-get update && apt-get install -y man git && rm -rf /var/lib/apt/lists/*pip install --requirement ./.devcontainer/dev_pip_requirements.txt
Generally, root
is not recommended for production environments.
Here is a little more information about postCreateCommand