每当我尝试在dev容器中打开代码时,我都会收到以下错误:
label=com.docker.compose.project=nodejs-express-jwt_devcontainer:
2020-04-12T17:35:08.591Z 22850 ms开始运行:码头检验型集装箱ad270338d286 2020-04-12T17:35:10.986Z 25245 ms启动:检查集装箱2020-04-12T17:35:10.986Z 25245 ms容器ad270338d286ba6db0560a94fd7a826bb563f17299799bfc1b8488becea02091 2020-04-12T17:35:14.884Z 29143 ms开始运行:运行: docker exec -i -u节点-e VSCODE_REMOTE_CONTAINERS_SESSION=6351885a-14c9-4520-8ac6-db1d1e4218231586712884962 ad270338d286ba6db0560a94fd7a826bb563f17299799bfc1b8488becea02091 /bin/sh 2020-04-12T17:35:14.899Z 29158 ms开始运行:在容器中运行: uname -m 2020- 04-12T17:35:27.282 Z 41541 ms启动:在容器中运行: cat /etc/passwd 2020-04-12T17:35:27.282Z 41541 ms Stdin!04-12T17:35:27.285Z 41544 ms Shell服务器终止(代码: 1,信号: null)没有这样的exec实例: 43330c7272221ead535677993be73423b5f6bdb8497429ee7380a81bb43bce59
我的.devcontainer里有这个文件
码头文件
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"
]
}我不知道为什么这不管用..。
发布于 2020-07-24 08:45:00
我认为问题可能在于您的api容器在运行git配置命令后终止。你有没有试着添加
command: sleep infinity到docker-compose.yml中的api服务。
发布于 2020-09-17 20:57:49
你说docker-composer.yml。这是您的文件名,那么它可能应该是docker-compose.yml。
https://stackoverflow.com/questions/61175598
复制相似问题