VSCode-Docker 不呼叫“CMD”

VSCode-Docker 不呼叫“CMD”

長話短說當我按下 Docker 桌面 UI 中的「運行」按鈕時,VSCode 建置的映像僅執行 CMD 命令。

大家好,

我正在使用 Drools 映像以及 Docker Desktop 和 VSCode。

我的devcontainer.json文件如下所示:

{
    "name": "Existing Dockerfile",
    "build": {
        // Sets the run context to one level up instead of the .devcontainer folder.
        "context": "..",
        // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
        "dockerfile": "../Dockerfile"
    },

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    "forwardPorts": [8001,8080]
}

我的Dockerfile是極簡主義的,如下:

FROM quay.io/kiegroup/business-central-workbench:latest

我的compose.yaml文件看起來像這樣:

services:
  app:
    entrypoint:
    - sleep
    - infinity
    image: docker/dev-environments-default:stable-1
    init: true
    volumes:
    - type: bind
      source: /var/run/docker.sock
      target: /var/run/docker.sock

問題是,當 VSCode 將映像傳送到 Docker Desktop 時, CMD ["./start_business-central-wb.sh"]父映像中找到的內容似乎沒有像日誌中看到的那樣被觸發

Docker 沒有運行 Image.PNG

但是,當我單擊“運行”時,命令會在生成新實例後啟動 在此輸入影像描述

在此輸入影像描述

為什麼當 VSCode 將 Docker 映像傳送到 Docker Desktop 時,它沒有立即開始運行,我缺少什麼概念?我對這兩種技術都非常缺乏經驗。

任何幫助是極大的讚賞。

答案1

問題是我沒有overrideCommand在我的devcontainer.json文件中使用。當該值設定為 false 時,允許容器中列出的 CMD 運行。

以下文件似乎做了我認為應該做的事情。

{
    "name": "Debian",
    "image": "quay.io/kiegroup/business-central-workbench:latest",
    "overrideCommand": false
}

相關內容