microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.67k stars 292 forks source link

Sleep command not found when launch a devcontainer with a compose file from windows #9680

Open cody-scott opened 7 months ago

cody-scott commented 7 months ago

Hello,

Getting an odd issue with respect to launching devcontainers from windows using a compose file.

My compose file is quite simple, it launches my folder in a devcontainer and should trigger the sleep infinity call on the container itself on start.

The error i see is sleep not found when i query the container on failure. I've tried with other commands (/bin/sh sleep or /bin/bash sleep or even ls and all commands return as not found.

Using linux containers and WSL2 with ubuntu,

remoteContainers-2024-03-20T01-44-20.694Z.log

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
    "name": "analytics",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    // "image": "mcr.microsoft.com/devcontainers/python:0-3.11",
    "dockerComposeFile": "docker-compose.yml",
    "service": "analytics",
    // "shutdownAction": "none",
    "workspaceFolder": "/workspace/core",

    "postCreateCommand": "bash /workspace/core/.devcontainer/setup_mssql.sh && bash /workspace/core/.devcontainer/setup_oracle.sh",
    "postStartCommand": "pip install -r requirements.txt && pip install -e \".[dev]\" && cd /workspace/dbt_project && dbt deps",

    "containerEnv": {
        "LD_LIBRARY_PATH": "/opt/instantclient_21_12",
        "PATH": "$PATH:/opt/instantclient_21_12"
    }
}
version: '3'
services:
  analytics:
    image: mcr.microsoft.com/devcontainers/python:0-3.11
    volumes:
      - ../..:/workspace
    command: sleep infinity

    networks:
      - devnet

networks:
  devnet:
    driver: bridge
cody-scott commented 7 months ago

The actual error is

Container started -: 4: exec: sleep: not found