![VSCode-Docker 不呼叫“CMD”](https://rvso.com/image/782623/VSCode-Docker%20%E4%B8%8D%E5%91%BC%E5%8F%AB%E2%80%9CCMD%E2%80%9D.png)
長話短說當我按下 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"]
父映像中找到的內容似乎沒有像日誌中看到的那樣被觸發
為什麼當 VSCode 將 Docker 映像傳送到 Docker Desktop 時,它沒有立即開始運行,我缺少什麼概念?我對這兩種技術都非常缺乏經驗。
任何幫助是極大的讚賞。
答案1
問題是我沒有overrideCommand
在我的devcontainer.json
文件中使用。當該值設定為 false 時,允許容器中列出的 CMD 運行。
以下文件似乎做了我認為應該做的事情。
{
"name": "Debian",
"image": "quay.io/kiegroup/business-central-workbench:latest",
"overrideCommand": false
}