I tried to run devcontainer. Set up files:
devcontainer.json
{
"name": "C++",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/git:1": {}
}
}
Dockerfile
FROM mcr.microsoft.com/devcontainers/cpp:0-debian-11
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2"
# Optionally install the cmake for vcpkg
COPY ./reinstall-cmake.sh /tmp/
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi \
&& rm -f /tmp/reinstall-cmake.sh
But when i try to run devcontainer i get error:
[2022-12-23T18:57:44.771Z] ERROR: invalid character '\x00' looking for beginning of value
[2022-12-23T18:57:44.863Z] Stop (969 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765\Dockerfile-with-features -t vsc-test-9da7bcb89243449acfae569e26bf0e4b --target dev_containers_target_stage --build-context dev_containers_feature_content_source=C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp c:\Projects\docker_projects\Cpp\test\.devcontainer
[2022-12-23T18:57:44.865Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765\Dockerfile-with-features -t vsc-test-9da7bcb89243449acfae569e26bf0e4b --target dev_containers_target_stage --build-context dev_containers_feature_content_source=C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp c:\Projects\docker_projects\Cpp\test\.devcontainer
[2022-12-23T18:57:44.866Z] at Doe (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1894:1669)
[2022-12-23T18:57:44.866Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-12-23T18:57:44.866Z] at async EF (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1893:1978)
[2022-12-23T18:57:44.866Z] at async uT (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1893:901)
[2022-12-23T18:57:44.866Z] at async Poe (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:2128)
[2022-12-23T18:57:44.867Z] at async Zf (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:3278)
[2022-12-23T18:57:44.867Z] at async aue (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15276)
[2022-12-23T18:57:44.867Z] at async oue (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15030)
[2022-12-23T18:57:44.882Z] Stop (5862 ms): Run: C:\Users\Bogus_Kladik.NEW-PC\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\Bogus_Kladik.NEW-PC\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Projects\docker_projects\Cpp\test --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Projects\docker_projects\Cpp\test --log-level debug --log-format json --config c:\Projects\docker_projects\Cpp\test\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-12-23T18:57:44.882Z] Exit code 1
[2022-12-23T18:57:44.889Z] Command failed: C:\Users\Bogus_Kladik.NEW-PC\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\Bogus_Kladik.NEW-PC\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Projects\docker_projects\Cpp\test --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Projects\docker_projects\Cpp\test --log-level debug --log-format json --config c:\Projects\docker_projects\Cpp\test\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-12-23T18:57:44.889Z] Exit code 1
How can I fix this problem?
Of the attempts, I can note the update of Docker Desktop, the update of wsl
The problem seems to be related to the use of BuildKit and Inline Cache in Docker.
The work-around suggested here is either:
To disable BuildKit in Docker:
Under Linux:
# in /etc/bash.bashrc
export DOCKER_BUILDKIT=0
Under Docker Dashboard:
Go to Settings > Docker Engine and set 'buildkit' to 'false':
"features": {
"buildkit": true
},
To disable the Inline Cache, either:
in the Dockerfile :
"args": {
"BUILDKIT_INLINE_CACHE": "0"
}
in the devcontainer.json:
"build": {
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_INLINE_CACHE": "0"
}
},
in the docker-compose.yml:
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
BUILDKIT_INLINE_CACHE: 0
Related
As I don't have access to Github Codespaces and I'm not the type of person to pay for Github Teams only for this... is it possible to run mcr.microsoft.com/vscode/devcontainers/universal:2.0.9-linux locally with docker?
I tried to use steps in https://github.com/microsoft/vscode-dev-containers/tree/main/containers/codespaces-linux to copy .devcontainer folder to my project folder, but when I try to use Remote-Containers: Reopen Folder in Container it stops with error:
[2022-09-05T22:07:51.999Z] Stop (218 ms): Run: docker inspect --type container 2e252fbefb8fa27f8e4d527747cb5da095103cd894f904fd94004f0fdbc8df93
[2022-09-05T22:07:51.999Z] Stop (218 ms): Inspecting container
[2022-09-05T22:07:51.999Z] Start: Run in container: /bin/sh
[2022-09-05T22:07:52.002Z] Start: Run in container: uname -m
[2022-09-05T22:07:52.016Z] Stop (17 ms): Run in container: /bin/sh
[2022-09-05T22:07:52.016Z] Shell server terminated (code: 1, signal: null)
[2022-09-05T22:07:52.016Z] Error response from daemon: Container 2e252fbefb8fa27f8e4d527747cb5da095103cd894f904fd94004f0fdbc8df93 is not running
[2022-09-05T22:07:52.016Z] Start: Run in container: cat /etc/passwd
[2022-09-05T22:07:52.016Z] Stdin closed!
[2022-09-05T22:07:52.017Z] Error: An error occurred setting up the container.
[2022-09-05T22:07:52.017Z] at SF (/home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js:257:2186)
[2022-09-05T22:07:52.017Z] at pb (/home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js:257:2124)
[2022-09-05T22:07:52.017Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-09-05T22:07:52.017Z] at async DF (/home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js:263:2006)
[2022-09-05T22:07:52.017Z] at async to (/home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js:263:3110)
[2022-09-05T22:07:52.017Z] at async Ak (/home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js:383:8108)
[2022-09-05T22:07:52.018Z] at async Ok (/home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js:383:7864)
[2022-09-05T22:07:52.021Z] Stop (736 ms): Run: /opt/visual-studio-code/code --ms-enable-electron-run-as-node /home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/randomperson/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /home/randomperson/Documents/Github/Bob --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/randomperson/Documents/Github/Bob --log-level debug --log-format json --config /home/randomperson/Documents/Github/Bob/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-09-05T22:07:52.021Z] Exit code 1
[2022-09-05T22:07:52.025Z] Command failed: /opt/visual-studio-code/code --ms-enable-electron-run-as-node /home/randomperson/.vscode/extensions/ms-vscode-remote.remote-containers-0.251.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/randomperson/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /home/randomperson/Documents/Github/Bob --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/randomperson/Documents/Github/Bob --log-level debug --log-format json --config /home/randomperson/Documents/Github/Bob/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-09-05T22:07:52.025Z] Exit code 1
Is there maybe an image with a specific tag that can be self-hosted or my machine is just too slow for this.
I am trying to run a dev container on my vsode for ruby on rails, however, I cannot and getting the following error:
[2022-07-14T15:35:08.995Z] ERROR: Version mismatch: file /home/parham/projects/ruby/.devcontainer/docker-compose.yml specifies version 2.4 but extension file /tmp/docker-compose/docker-compose.devcontainer.build-1657812908036.yml uses version 1
[2022-07-14T15:35:09.136Z] Stop (1097 ms): Run: docker-compose --project-name ruby_devcontainer -f /home/parham/projects/ruby/.devcontainer/docker-compose.yml -f /tmp/docker-compose/docker-compose.devcontainer.build-1657812908036.yml build
[2022-07-14T15:35:09.669Z] Error: Command failed: docker-compose --project-name ruby_devcontainer -f /home/parham/projects/ruby/.devcontainer/docker-compose.yml -f /tmp/docker-compose/docker-compose.devcontainer.build-1657812908036.yml build
[2022-07-14T15:35:09.669Z] at Uu (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:204:419)
[2022-07-14T15:35:09.669Z] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-07-14T15:35:09.670Z] at async kR (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:204:2335)
[2022-07-14T15:35:09.670Z] at async DR (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:188:2228)
[2022-07-14T15:35:09.670Z] at async QR (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:2177)
[2022-07-14T15:35:09.670Z] at async cb (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:3110)
[2022-07-14T15:35:09.670Z] at async i_ (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:13194)
[2022-07-14T15:35:09.670Z] at async n_ (/home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:12950)
[2022-07-14T15:35:09.682Z] Stop (6372 ms): Run in Host: /home/parham/.vscode-server/bin/92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9/node /home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /home/parham/projects/ruby --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/parham/projects/ruby --log-level debug --log-format json --config /home/parham/projects/ruby/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-07-14T15:35:09.684Z] Exit code 1
[2022-07-14T15:35:09.689Z] Command failed: /home/parham/.vscode-server/bin/92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9/node /home/parham/.vscode-remote-containers/dist/dev-containers-cli-0.241.3/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /home/parham/projects/ruby --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/parham/projects/ruby --log-level debug --log-format json --config /home/parham/projects/ruby/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-07-14T15:35:09.689Z] Exit code 1
UPDATE
This is my .devcotnainer.json which forwards some ports and they are the only changes that I have added to the code.
{
"name": "Ruby on Rails & Postgres",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"customizations": {
"vscode": {
"extensions": [
"rebornix.Ruby"
]
}
},
"forwardPorts": ["30000:3000", "54320:5432"],
"remoteUser": "vscode",
"features": {
"git": "latest",
"python": "latest"
}
}
If you would like to reproduce select all additional features. That will cause error.
I have a docker image in ECR, which is used for my ECS task. The task spins up and runs for a couple of minutes. Then it shuts down, after reporting the following error:
2021-11-07 00:00:58npm ERR! A complete log of this run can be found in:
2021-11-07 00:00:58npm ERR! /home/node/.npm/_logs/2021-11-07T00_00_58_665Z-debug.log
2021-11-07 00:00:58npm ERR! signal SIGTERM
2021-11-07 00:00:58npm ERR! command sh -c node bin/www
2021-11-07 00:00:58npm ERR! command failed
2021-11-07 00:00:58npm ERR! path /usr/src/app
2021-11-06 23:59:25> my-app#0.0.0 start
2021-11-06 23:59:25> node bin/www
My Dockerfile looks like:
LABEL maintainer="my-team"
LABEL description="App for AWS ECS"
EXPOSE 8080
WORKDIR /usr/src/app
RUN chown -R node:node /usr/src/app
RUN apk add bash
RUN apk add openssl
COPY --chown=node src/package*.json ./
USER node
ARG NODE_ENV=dev
ENV NODE_ENV ${NODE_ENV}
RUN npm ci
COPY --chown=node ./src/generate-cert.sh ./
RUN ./generate-cert.sh
COPY --chown=node src/ ./
ENTRYPOINT ["npm","start"]
My package.json contains:
{
"name": "my-app",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"test": "jest --coverage"
},
The app is provisioned using terraform, with the following task definition:
resource "aws_ecs_task_definition" "task_definition" {
family = "dataviz_task"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = "256"
memory = "512"
task_role_arn = aws_iam_role.dataviz_ecs_role.arn
execution_role_arn = aws_iam_role.dataviz_ecs_task_execution_role.arn
container_definitions = jsonencode([{
entryPoint : [
"npm",
"start"
],
environment : [
{ "name" : "ENV", "value" : local.container_environment }
]
essential : true,
image : "${var.account_id}${var.ecr_image_address}:latest",
lifecycle : {
ignore_changes : "image"
}
logConfiguration : {
"logDriver" : "awslogs",
"options" : {
"awslogs-group" : var.log_stream_name,
"awslogs-region" : var.region,
"awslogs-stream-prefix" : "ecs"
}
},
name : local.container_name,
portMappings : [
{
"containerPort" : local.container_port,
"hostPort" : local.host_port,
"protocol" : "tcp"
}
]
}])
}
My application runs locally in docker, but not when using the same image in AWS ECS.
To run locally, I uses a Make command make restart
which runs this from my Makefile:
build:
#docker build \
--build-arg NODE_ENV=local \
--tag $(DEV_IMAGE_TAG) \
. > /dev/null
.PHONY: package
package:
#docker build \
--tag $(PROD_IMAGE_TAG) \
--build-arg NODE_ENV=production \
. > /dev/null
.PHONY: start
start: build
#docker run \
--rm \
--publish 8080:8080 \
--name $(IMAGE_NAME) \
--detach \
--env ENV=local \
$(DEV_IMAGE_TAG) > /dev/null
.PHONY: stop
stop:
#docker stop $(IMAGE_NAME) > /dev/null
.PHONY: restart
restart:
ifeq ($(shell (docker ps | grep $(IMAGE_NAME))),)
#make start > /dev/null
else
#make stop > /dev/null
#make start > /dev/null
endif
Why does my docker image fail when running as task in AWS ECS (Fargate)?
I need to use host ssh key inside docker , for this purpose i have build docker like
docker build -t example --build-arg ssh_prv_key="$(cat ~/.ssh/id_rsa)" -f dockerfile-dev .
if we use direct docker command it is working fine , but if I use inside the jenkins pipe-line script getting below error
Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 92: expecting '}', found 'ssh_prv_key' # line 92, column 116.
ev:${GIT_COMMIT} "--build-arg ssh_prv_ke
Below step i have used in jenkins pipe-line
sh "docker build -t ${service_name}-dev:${GIT_COMMIT} --build-arg ssh_prv_key="$(cat ~/.ssh/id_rsa)" -f dockerfile-dev ."
And docker file used like below
ARG ssh_prv_key
# Authorize SSH Host
# Add the keys and set permissions
RUN mkdir -p /root/.ssh
RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa
I solved a similar issue as follow:
Jenkins pipeline
sh "cp ~/.ssh/id_rsa id_rsa"
sh "docker build -t ${service_name}-dev:${GIT_COMMIT} -f dockerfile-dev ."
sh "rm id_rsa"
Dockerfile
# Some instructions...
ADD id_rsa id_rsa
# Now use the "id_rsa" file inside the image...
I'm using VSCode Devcontainers to develop a micro-services application and I've been using a Java Devcontainer without issues.
But, given the micro-service nature of the project, there are other containers I need to execute (for instance, a postgres db).
This is the only container I use to develop, where I install Java-specific extensions, intellisense working, etc. I do NOT have this on my local machine nor do I want to have. Only when coding on the container.
Now, I did some research to shift the use of Devcontainers to docker-compose and start not only the Java devcontainer but also the database.
Everything seems to run fine.
However, the dev container will alway exit with code 137 and I can't figure out why.
The structure of the code is as follows:
|.devcontainer
|--devcontainer.json
|--Dockerfile
|--docker-compose.yaml
|.git
|actionable-content
|--(my module code)
|db
|--Dockerfile
|--init.sql
|(...)
This is the output of the containers build commands:
[18 ms] Start: Resolving remote
[20 ms] Setting up container for folder or workspace: /Users/zed/Projects/circle-labs
[39 ms] Start: Check Docker is running
[39 ms] Start: Run: docker info
[401 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=evooq-circle --filter label=com.docker.compose.service=dev-container
[444 ms] Start: Run: docker inspect --type container ea365c78bc6d
[490 ms] Start: Removing existing container.
[490 ms] Start: Run: docker rm -f ea365c78bc6d229737805fe4121324b45c87688ccd369bccebf209689f2658d7
[611 ms] Start: Run: docker-compose -f /Users/zed/Projects/circle-labs/.devcontainer/docker-compose.yaml config --services
[1027 ms] Start: Run: docker events --format {{json .}} --filter status=start
[1032 ms] Start: Run: docker-compose --project-name evooq-circle -f /Users/zed/Projects/circle-labs/.devcontainer/docker-compose.yaml up -d --build db dev-container
Building db
Step 1/2 : FROM postgres:9.6
---> 16f0ba6ed857
Step 2/2 : COPY init.sql /docker-entrypoint-initdb.d/
---> Using cache
---> e90f4e0c7c73
Successfully built e90f4e0c7c73
Successfully tagged evooq-circle_db:latest
Building dev-container
Step 1/15 : FROM openjdk:11-jdk
---> a548e8a50190
Step 2/15 : ARG USERNAME=vscode
---> Using cache
---> bd1352aa5e59
Step 3/15 : ARG USER_UID=1000
---> Using cache
---> 192dca586afc
Step 4/15 : ARG USER_GID=$USER_UID
---> Using cache
---> 91a3124b064c
Step 5/15 : ENV DEBIAN_FRONTEND=noninteractive
---> Using cache
---> 222b620a3e1b
Step 6/15 : RUN apt-get update && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 && groupadd --gid $USER_GID $USERNAME && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME && apt-get install -y sudo && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && chmod 0440 /etc/sudoers.d/$USERNAME && apt-get -y install git openssh-client less iproute2 procps curl lsb-release
---> Using cache
---> 8ad502a168f4
Step 7/15 : ARG MAVEN_VERSION=3.6.3
---> Using cache
---> 2f0fed0ae029
Step 8/15 : ARG MAVEN_SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
---> Using cache
---> ba172229c081
Step 9/15 : RUN mkdir -p /usr/share/maven /usr/share/maven/ref && curl -fsSL -o /tmp/apache-maven.tar.gz https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz && echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 && rm -f /tmp/apache-maven.tar.gz && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
---> Using cache
---> 033989c61d1f
Step 10/15 : COPY maven-settings.xml /usr/share/maven/ref/
---> Using cache
---> 5dcb163d3198
Step 11/15 : ENV MAVEN_HOME /usr/share/maven
---> Using cache
---> 9c21dcb2fa42
Step 12/15 : ENV MAVEN_CONFIG /root/.m2
---> Using cache
---> 56960418c145
Step 13/15 : RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 939839f8b869
Step 14/15 : ENV DEBIAN_FRONTEND=dialog
---> Using cache
---> da8ceada8e6f
Step 15/15 : RUN if [ ! -d "/docker-java-home" ]; then ln -s "${JAVA_HOME}" /docker-java-home; fi
---> Using cache
---> 8781e2f051b0
Successfully built 8781e2f051b0
Successfully tagged evooq-circle_dev-container:latest
evooq-circle_db_1 is up-to-date
Creating evooq-circle_dev-container_1 ... done
[2449 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=evooq-circle --filter label=com.docker.compose.service=dev-container
[2507 ms] Start: Run: docker inspect --type container f11a0e8f78c2
[2555 ms] Start: Inspecting container
[2555 ms] Start: Run: docker inspect --type container f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49
[2609 ms] Start: Run: docker exec -i -u root -e VSCODE_REMOTE_CONTAINERS_SESSION=190e175e-f482-4554-aaf4-e062c672fcdb1593105541203 f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 /bin/sh
[2614 ms] Start: Run in container: uname -m
[2753 ms] x86_64
[2753 ms]
[2753 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[2761 ms] PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
[2761 ms]
[2761 ms] Start: Run in container: cat /etc/passwd
[2765 ms] Start: Updating configuration state
[2770 ms] Start: Setup shutdown monitor
[2773 ms] Forking shutdown monitor: /Users/zed/.vscode/extensions/ms-vscode-remote.remote-containers-0.122.1/dist/shutdownMonitorProcess /var/folders/bp/bjk1_4fs2ljdx8pflq89nd500000gn/T/vscode-remote-containers-e8ace0f38179417fa6822e6d83141fd504155ae0.sock dockerCompose Info /Users/zed/Library/Application Support/Code/logs/20200625T091545/exthost3/ms-vscode-remote.remote-containers
[2779 ms] Start: Run in container: test -d /root/.vscode-server
[2785 ms]
[2785 ms]
[2785 ms] Exit code 1
[2785 ms] Start: Run in container: test -d /root/.vscode-remote
[2788 ms]
[2788 ms]
[2788 ms] Exit code 1
[2788 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[2797 ms]
[2797 ms]
[2797 ms] Start: Run in container: mkdir -p '/root/.vscode-server/data/Machine' && cat >'/root/.vscode-server/data/Machine/settings.json' <<'settingsJSON'
[2804 ms]
[2804 ms]
[2804 ms] Start: Run in container: test -d /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
[2806 ms]
[2806 ms]
[2806 ms] Exit code 1
[2807 ms] Installing VS Code Server for commit cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
[2807 ms] Start: Run in container: mkdir -p /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d_1593105545145
[2811 ms]
[2811 ms]
[2812 ms] Start: Run: docker exec -i -u root -w /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d_1593105545145 f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 tar --no-same-owner -xz --strip-components 1
[5305 ms]
[5306 ms]
[5306 ms] Start: Run in container: mv -n /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d_1593105545145 /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
[5317 ms]
[5317 ms]
[5317 ms] Start: Launching Remote-Containers helper.
[5318 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[5343 ms] Start: Run in container: gpgconf --list-dir agent-socket
[5348 ms] /root/.gnupg/S.gpg-agent
[5348 ms]
[5348 ms] Start: Run in container: mkdir -p -m 700 '/root/.gnupg'
[5356 ms]
[5356 ms]
[5356 ms] Start: Run in container: # Copy /Users/zed/.gitconfig to /root/.gitconfig
[5356 ms] Start: Run: gpgconf --list-dir homedir
[5369 ms]
[5369 ms]
[5369 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-f97cc7a21081e70e2303f2544443a16dbafee09f.js' >/tmp/vscode-remote-containers-f97cc7a21081e70e2303f2544443a16dbafee09f.js
[5382 ms]
[5382 ms]
[5382 ms] Start: Run in container: gpgconf --list-dir homedir
[5401 ms] /root/.gnupg
[5401 ms]
[5401 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global credential.helper '!f() { /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node /tmp/vscode-remote-containers-f97cc7a21081e70e2303f2544443a16dbafee09f.js $*; }; f' || true
[5419 ms]
[5419 ms]
[5420 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-f97cc7a21081e70e2303f2544443a16dbafee09f.js' >/tmp/vscode-remote-containers-server-f97cc7a21081e70e2303f2544443a16dbafee09f.js
[5442 ms]
[5442 ms]
[5443 ms] Start: Run in container: # Copy /Users/zed/.gnupg/pubring.kbx to /root/.gnupg/pubring.kbx
[5445 ms] Start: Run: docker exec -i -u root -e REMOTE_CONTAINERS_SOCKETS=["/tmp/vscode-ssh-auth-f97cc7a21081e70e2303f2544443a16dbafee09f.sock","/root/.gnupg/S.gpg-agent"] -e REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-f97cc7a21081e70e2303f2544443a16dbafee09f.sock f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node /tmp/vscode-remote-containers-server-f97cc7a21081e70e2303f2544443a16dbafee09f.js
[5482 ms]
[5482 ms]
[5482 ms] Start: Run in container: set -o noclobber ; mkdir -p '/root/.vscode-server/data/Machine' && { > '/root/.vscode-server/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[5494 ms]
[5494 ms]
[5494 ms] Start: Run in container: # Copy /Users/zed/.gnupg/trustdb.gpg to /root/.gnupg/trustdb.gpg
[5529 ms]
[5529 ms]
[5529 ms] Start: Run in container: test -d /root/.vscode-server/extensionsCache && ls /root/.vscode-server/extensionsCache || true
[5530 ms] Start: Run: gpg-connect-agent updatestartuptty /bye
[5536 ms]
[5536 ms]
[5539 ms] Start: Run in container: mkdir -p /root/.vscode-server/extensionsCache/tmp-1593105547877
[5553 ms]
[5553 ms]
[5553 ms] Start: Run: docker exec -i -u root -w /root/.vscode-server/extensionsCache/tmp-1593105547877 f11a0e8f78c28d23046be8ff36fa28a18bc2d1147d24bd04f3aac39f7d02cb49 tar x --strip-components 1
[6353 ms] Start: Run in container: mv /root/.vscode-server/extensionsCache/tmp-1593105547877/* /root/.vscode-server/extensionsCache && rmdir /root/.vscode-server/extensionsCache/tmp-1593105547877
[6393 ms]
[6394 ms]
[6394 ms] Start: Run in container: cd /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d; export VSCODE_AGENT_FOLDER=/root/.vscode-server; /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/server.sh --extensions-download-dir /root/.vscode-server/extensionsCache --install-extension vscjava.vscode-java-pack --install-extension pivotal.vscode-boot-dev-pack --install-extension github.vscode-pull-request-github --install-extension kumar-harsh.graphql-for-vscode --install-extension zxh404.vscode-proto3 --install-extension humao.rest-client --force
[6704 ms] Start: Run in container: ls /root/.vscode-server/extensionsCache
[6704 ms] Stdin closed!
[6706 ms] Shell server terminated (code: 137, signal: null)
[6747 ms] Remote-Containers server terminated (code: 137, signal: null).
I suspect the issue may lie in the extensions installation process, but I'm not entirely sure.
Anyway, I went from this combination of devcontainer.json + Dockerfile here (gist), to the combination of devcontainer.json + docker-compose.yaml + Dockerfile, that are here (another gist).
What could be causing the errors above? I'm really lost here as I don't see a reason.
Also, I suspect I need the runArgs from the initial version but they seem not to be supported when using docker-compose mode.
Thanks
Well, for any of you that end up here looking here, here's what I changed that did the trick:
On my docker-compose.yaml I added the following:
volumes:
# Make the first part whatever your working dir is
- ..:/workspace:cached
- "${HOME}/.ssh:/root/.ssh-localhost:ro"
command: /bin/sh -c "while sleep 1000; do :; done"
On the Dockerfile I added a CMD to the end as well:
CMD [ "sleep", "infinity" ]
Then, rebuild the image, and it should work.
Also, regarding the runArgs, I added this to my docker-compose.yaml file:
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
These additions/modifications should do the trick for you as well
This is the command I always use in any Dockerfile for VSCode:
# Keep container running (for use in VSCode)
CMD [ "tail", "-f", "/dev/null" ]