Docker VS code remove devcontainer

Docker VS code remove devcontainer,docker,visual-studio-code,docker-compose,dockerfile,vscode-remote,Docker,Visual Studio Code,Docker Compose,Dockerfile,Vscode Remote,每次尝试在devcontainer中打开代码时,我都会收到以下错误: [2020-04-12T17:35:08.489Z][PID 4968][22748毫秒]开始:运行:docker ps -q-a——过滤器标签=com.docker.compose.project=nodejs-express-jwt\u devcontainer --过滤器标签=com.docker.compose.service=api[2020-04-12T17:35:08.591Z][PID 4968][22850

每次尝试在devcontainer中打开代码时,我都会收到以下错误:

[2020-04-12T17:35:08.489Z][PID 4968][22748毫秒]开始:运行:docker ps -q-a——过滤器标签=com.docker.compose.project=nodejs-express-jwt\u devcontainer --过滤器标签=com.docker.compose.service=api[2020-04-12T17:35:08.591Z][PID 4968][22850 ms]开始:运行:docker 检验——类型容器ad270338d286[2020-04-12T17:35:10.986Z][PID 4968][25245毫秒]开始:检查集装箱 [2020-04-12T17:35:10.986Z][PID 4968][25245毫秒]开始:运行:docker 检查——类型容器 AD270338D286BA6DB0560A94FD7A826BB563F1729999BFC1B8488BECEA02091 [2020-04-12T17:35:14.884Z][PID 4968][29143毫秒]开始:运行:docker exec-i-u节点-e VSCODE_REMOTE_CONTAINERS_SESSION=6351885a-14c9-4520-8ac6-db1d1e4218231586712884962 AD270338D286BA6DB0560A94FD7A826BB563F1729999BFC1B8488BECEA02091 /bin/sh[2020-04-12T17:35:14.899Z][PID 4968][29158 ms]启动:磨合 容器:uname-m[2020-04-12T17:35:27.282Z][PID 4968][41541 ms] 开始:在容器中运行:cat/etc/passwd[2020-04-12T17:35:27.282Z] [PID 4968][41541 ms]标准输入关闭![2020-04-12T17:35:27.285Z][PID 4968][41544 ms]外壳服务器已终止(代码:1,信号:null)否 此类exec实例: 43330C72221AD535677993BE73423B5F6BDB8497429EE7380A81BB43BCE59

我的.devcontainer中有此文件

Docker文件

FROM node:12.16-alpine

#Linux setup
RUN apk update \
  && apk add --update alpine-sdk \
  && apk add --no-cache git \
  && apk add --no-cache npm \
  && npm cache verify
  # && sed -i -e "s/bin\/ash/bin\/sh/" /etc/passwd

RUN git config --global user.email "my@email.com" \
    && git config --global user.name "My Name"
docker composer.yml

version: '3.3'

services:
    api:
        build: .
        restart: always
        depends_on: 
            - db
        ports: 
            - 3000:80
        environment: 
            DB_HOST: db
            DB_USER: apiuser
            DB_PASSWORD: apipass
            DB_NAME: apidb
        # volumes: 
        #     - ./src:/var/www/html/wp-content/plugins/meu-plugin

    db:
        image: mysql:5.7
        restart: always
        environment: 
            MYSQL_DATABASE: apidb
            MYSQL_USER: apiuser
            MYSQL_PASSWORD: apipass
            MYSQL_RANDOM_ROOT_PASSWORD: '1'
        volumes: 
            - db:/var/lib/mysql

    adminer:
        depends_on: 
            - db
        image: adminer
        restart: always
        ports: 
            - 8888:8080

networks: 
    back:

volumes: 
    db:
devcontainer.json

{
    "name": "Node.js",
    // "dockerFile": "Dockerfile",
    "service": "api",
    "dockerComposeFile": "docker-compose.yml",

    // Use 'appPort' to create a container with published ports. If the port isn't working, be sure
    // your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost.
    "appPort": [3000],

    // Comment out the next line to run as root instead.
    "remoteUser": "node",

    // Use 'settings' to set *default* container specific settings.json values on container create. 
    // You can edit these settings after create using File > Preferences > Settings > Remote.
    "settings": {
        "terminal.integrated.shell.linux": "/bin/sh"
    },

    // Specifies a command that should be run after the container has been created.
    // "postCreateCommand": "yarn install",

    // Add the IDs of extensions you want installed when the container is created in the array below.
    "extensions": [
        "dbaeumer.vscode-eslint"
    ]

}

我不知道这为什么不起作用…

我认为问题可能是,在运行git config命令后,api容器正在终止。你有没有试着添加

command: sleep infinity

到您的
docker compose.yml

中的api服务,您说的是
docker composer.yml
。如果这是您的文件名,那么它可能应该是
docker compose.yml

这正是我遇到的问题。如果可能,VS代码应该对此问题添加一些注释。它在VS代码的文档中有说明,但是。。。即使我读了文件,我也没有想到。