Vscode-remote-release: Missing env variables - "The X variable is not set."

Created on 2 Nov 2020  ยท  1Comment  ยท  Source: microsoft/vscode-remote-release


  • VSCode Version: 1.50.1
  • Local OS Version: macOS Catalina 10.15.7 (19H2)
  • Remote OS Version: -
  • Remote Extension/Connection Type: Docker

Steps to Reproduce:

  1. catalog structure:
.devcontainer
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ devcontainer.env
โ”œโ”€โ”€ devcontainer.json
โ”œโ”€โ”€ docker
โ”‚   โ””โ”€โ”€ images
โ”‚       โ”œโ”€โ”€ mysql
โ”‚       โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚       โ”‚   โ”œโ”€โ”€ conf.d
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ dev.cnf
โ”‚       โ”‚   โ”œโ”€โ”€ entrypoint.sh
โ”‚       โ”‚   โ””โ”€โ”€ init
โ”‚       โ”‚       โ””โ”€โ”€ demo.sql
โ”‚       โ””โ”€โ”€ python
โ”‚           โ”œโ”€โ”€ .gitkeep
โ”‚           โ””โ”€โ”€ Dockerfile
โ””โ”€โ”€ docker-compose.yml
  1. .env file is equal devcontainer.env:
DOCKER_CACHE_PATH=../cache/docker
  1. devcontainer.json:
"dockerComposeFile": "docker-compose.yml",
"service": "python",
"workspaceFolder": "/home/appuser",
"initializeCommand": "export $(cat ./.devcontainer/devcontainer.env | xargs) && printenv",
"postCreateCommand": "pipenv install --dev && echo 'eval \"$(env _PIPENV_COMPLETE=source-bash pipenv)\"' >> ~/.bashrc",
"remoteUser": "appuser",
  1. use env variable in docker-compose.yml file like:
services:
  mysql:
    build:
      context: ./docker/images/mysql
    ports:
      - 3306:3306
    volumes:
      - ${DOCKER_CACHE_PATH}/db:/var/lib/mysql
  1. "Reopen in container" execution log has:
[2020-11-02T22:47:20.493Z] [PID 62411] DOCKER_CACHE_PATH=../cache/docker
[2020-11-02T22:47:20.495Z] [PID 62411] [594 ms] Start: Run: docker-compose version --short
[2020-11-02T22:47:20.858Z] [PID 62411] [957 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=playgroundpython_devcontainer --filter label=com.docker.compose.service=python
[2020-11-02T22:47:20.979Z] [PID 62411] [1078 ms] Start: Run: docker-compose -f /Users/tonysoloveyv/Projects/playground.python/.devcontainer/docker-compose.yml config --services
[2020-11-02T22:47:21.356Z] [PID 62411] [1455 ms] mysql
[2020-11-02T22:47:21.357Z] [PID 62411] [1456 ms] The DOCKER_CACHE_PATH variable is not set. Defaulting to a blank string.

What am I doing wrong?

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Yes

*question containers

Most helpful comment

Try moving .env to your project folder (one folder up). We use that as the working directory for docker-compose and that's where it looks for a .env file.

>All comments

Try moving .env to your project folder (one folder up). We use that as the working directory for docker-compose and that's where it looks for a .env file.

Was this page helpful?
0 / 5 - 0 ratings