Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 17 fails installing #1031

Closed
spotlesscoder opened this issue Jul 4, 2024 · 2 comments · Fixed by #1152
Closed

Java 17 fails installing #1031

spotlesscoder opened this issue Jul 4, 2024 · 2 comments · Fixed by #1152

Comments

@spotlesscoder
Copy link

devcontainer.json

{
    "name": "Playground - Java 22 Spring Boot 3",
    "dockerComposeFile": "docker-compose.yml",
    "service": "devcontainer",
    "workspaceFolder": "/workspaces/$[localWorkspaceFolderBasename}",
    "shutdownAction": "stopCompose",
    "features": {
        "ghcr.io/devcontainers/features/java:1": {
            "version": "17",
            "installMaven": "true",
            "installGradle": "false"
        },

        "ghcr.io/devcontainers/features/node:1": {
            "version": "20"
        },
        "ghcr.io/devcontainers/features/docker-in-docker:2": {
            "version": "latest",
            "moby": true
        }
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "christian-kohler.path-intellisense",
                "eamodio.gitlens",
                "mongodb.mongodb-vscode",
                "ms-azuretools.vscode-docker",
                "SonarSource.sonarlint-vscode",
                "vscjava.vscode-java-pack",
                "vscjava.vscode-lombok"
            ],
            "settings": {
                "editor.formatOnSave": true
            }
        }
    },
    "remoteEnv": {
        "EDITOR": "nano"
    },
    "forwardPorts": [8080]
}

Dockerfile

FROM mcr.microsoft.com/devcontainers/java:17

RUN sudo apt update \
    && sudo apt upgrade -y \
    && rm -rf /var/lists/apt/lists/* \
    && sudo apt clean

docker-compose.yml

services:
  devcontainer:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ../..:workspaces:cached
    network_mode: service:db
    command: sleep infinity

  db:
    image: mongo:7
    restart: unless-stopped
    volumes:
      - mongo-data:/data/db

volumes:
  mongo-data:

I get the following error message

 => [devcontainer] resolve image config for docker-image://docker.io/dock  0.9s
 => CACHED [devcontainer] docker-image://docker.io/docker/dockerfile:1.4@  0.0s
 => [devcontainer internal] load .dockerignore                             0.0s
 => => transferring context: 2B                                            0.0s
 => [devcontainer context dev_containers_feature_content_source] load .do  0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
[2024-07-04T21:36:00.430Z]  => [devcontainer internal] load metadata for mcr.microsoft.com/devcontai  0.2s
 => [devcontainer dev_container_auto_added_stage_label 1/2] FROM mcr.micr  0.0s
 => [devcontainer context dev_containers_feature_content_source] load fro  0.0s
 => => transferring dev_containers_feature_content_source: 37.67kB         0.0s
 => CACHED [devcontainer dev_container_auto_added_stage_label 2/2] RUN su  0.0s
 => CACHED [devcontainer dev_containers_target_stage 1/6] RUN mkdir -p /t  0.0s
 => CACHED [devcontainer dev_containers_feature_content_normalize 1/2] CO  0.0s
 => CACHED [devcontainer dev_containers_feature_content_normalize 2/2] RU  0.0s
 => CACHED [devcontainer dev_containers_target_stage 2/6] COPY --from=dev  0.0s
 => CACHED [devcontainer dev_containers_target_stage 3/6] RUN echo "_CONT  0.0s
 => CACHED [devcontainer dev_containers_target_stage 4/6] RUN --mount=typ  0.0s
 => ERROR [devcontainer dev_containers_target_stage 5/6] RUN --mount=type  7.4s
                                                                                
                                                                                
------
 > [devcontainer dev_containers_target_stage 5/6] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=java_1,target=/tmp/build-features-src/java_1     cp -ar /tmp/build-features-src/java_1 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/java_1  && cd /tmp/dev-container-features/java_1  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/java_1:
0.237 ===========================================================================
0.237 Feature       : Java (via SDKMAN!)
0.237 Description   : Installs Java, SDKMAN! (if not installed), and needed dependencies.
0.237 Id            : ghcr.io/devcontainers/features/java
0.237 Version       : 1.5.0
0.237 Documentation : https://github.com/devcontainers/features/tree/main/src/java
0.237 Options       :
0.237     VERSION="17"
0.237     ADDITIONALVERSIONS=""
0.237     JDKDISTRO="ms"
[2024-07-04T21:36:00.430Z] 0.237     INSTALLGRADLE="false"
0.237     GRADLEVERSION="latest"
0.237     INSTALLMAVEN="true"
0.237     MAVENVERSION="latest"
0.237     INSTALLANT="false"
0.237     ANTVERSION="latest"
0.237     INSTALLGROOVY="false"
0.237     GROOVYVERSION="latest"
0.237 ===========================================================================
7.354 Version 17 not found. Available versions:
7.354 
7.354 ERROR: Feature "Java (via SDKMAN!)" (ghcr.io/devcontainers/features/java) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/java for help troubleshooting this error.
------
[2024-07-04T21:36:00.430Z] failed to solve: process "/bin/sh -c cp -ar /tmp/build-features-src/java_1 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/java_1  && cd /tmp/dev-container-features/java_1  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/java_1" did not complete successfully: exit code: 1
[2024-07-04T21:36:00.438Z] Stop (8918 ms): Run: docker compose --project-name java22-springboot3-devcontainer_devcontainer -f /home/user/java22-springboot3-devcontainer/.devcontainer/docker-compose.yml -f /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1720128951520.yml build
[2024-07-04T21:36:00.439Z] Error: Command failed: docker compose --project-name java22-springboot3-devcontainer_devcontainer -f /home/user/java22-springboot3-devcontainer/.devcontainer/docker-compose.yml -f /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1720128951520.yml build
[2024-07-04T21:36:00.439Z]     at Km (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:430:525)
[2024-07-04T21:36:00.439Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-07-04T21:36:00.439Z]     at async QtA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:430:2476)
[2024-07-04T21:36:00.439Z]     at async utA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:410:3506)
[2024-07-04T21:36:00.439Z]     at async KtA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:482:3944)
[2024-07-04T21:36:00.439Z]     at async eB (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:482:4886)
[2024-07-04T21:36:00.440Z]     at async hrA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:662:13704)
[2024-07-04T21:36:00.440Z]     at async lrA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:662:13452)
[2024-07-04T21:36:00.450Z] Stop (12838 ms): Run: /usr/share/code/code /home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-9e6f1aef-ce08-4ea7-88e9-ff6a4be9a6d41720128946565 --workspace-folder /home/user/java22-springboot3-devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/user/java22-springboot3-devcontainer --id-label devcontainer.config_file=/home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-0e3a24b4-33b9-49c5-be8f-56b709045557.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2024-07-04T21:36:00.450Z] Exit code 1
[2024-07-04T21:36:00.455Z] Command failed: /usr/share/code/code /home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-9e6f1aef-ce08-4ea7-88e9-ff6a4be9a6d41720128946565 --workspace-folder /home/user/java22-springboot3-devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/user/java22-springboot3-devcontainer --id-label devcontainer.config_file=/home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-0e3a24b4-33b9-49c5-be8f-56b709045557.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2024-07-04T21:36:00.455Z] Exit code 1
@samruddhikhandale
Copy link
Member

Hi 👋

Do you mind retrying? I wonder it it was some kind of flakiness.

A simple repro worked for me, see 👇

Image

@Nicha142
Copy link

devcontainer.json

{
    "name": "Playground - Java 22 Spring Boot 3",
    "dockerComposeFile": "docker-compose.yml",
    "service": "devcontainer",
    "workspaceFolder": "/workspaces/$[localWorkspaceFolderBasename}",
    "shutdownAction": "stopCompose",
    "features": {
        "ghcr.io/devcontainers/features/java:1": {
            "version": "17",
            "installMaven": "true",
            "installGradle": "false"
        },

        "ghcr.io/devcontainers/features/node:1": {
            "version": "20"
        },
        "ghcr.io/devcontainers/features/docker-in-docker:2": {
            "version": "latest",
            "moby": true
        }
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "christian-kohler.path-intellisense",
                "eamodio.gitlens",
                "mongodb.mongodb-vscode",
                "ms-azuretools.vscode-docker",
                "SonarSource.sonarlint-vscode",
                "vscjava.vscode-java-pack",
                "vscjava.vscode-lombok"
            ],
            "settings": {
                "editor.formatOnSave": true
            }
        }
    },
    "remoteEnv": {
        "EDITOR": "nano"
    },
    "forwardPorts": [8080]
}

Dockerfile

FROM mcr.microsoft.com/devcontainers/java:17

RUN sudo apt update \
    && sudo apt upgrade -y \
    && rm -rf /var/lists/apt/lists/* \
    && sudo apt clean

docker-compose.yml

services:
  devcontainer:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ../..:workspaces:cached
    network_mode: service:db
    command: sleep infinity

  db:
    image: mongo:7
    restart: unless-stopped
    volumes:
      - mongo-data:/data/db

volumes:
  mongo-data:

I get the following error message

 => [devcontainer] resolve image config for docker-image://docker.io/dock  0.9s
 => CACHED [devcontainer] docker-image://docker.io/docker/dockerfile:1.4@  0.0s
 => [devcontainer internal] load .dockerignore                             0.0s
 => => transferring context: 2B                                            0.0s
 => [devcontainer context dev_containers_feature_content_source] load .do  0.0s
 => => transferring dev_containers_feature_content_source: 2B              0.0s
[2024-07-04T21:36:00.430Z]  => [devcontainer internal] load metadata for mcr.microsoft.com/devcontai  0.2s
 => [devcontainer dev_container_auto_added_stage_label 1/2] FROM mcr.micr  0.0s
 => [devcontainer context dev_containers_feature_content_source] load fro  0.0s
 => => transferring dev_containers_feature_content_source: 37.67kB         0.0s
 => CACHED [devcontainer dev_container_auto_added_stage_label 2/2] RUN su  0.0s
 => CACHED [devcontainer dev_containers_target_stage 1/6] RUN mkdir -p /t  0.0s
 => CACHED [devcontainer dev_containers_feature_content_normalize 1/2] CO  0.0s
 => CACHED [devcontainer dev_containers_feature_content_normalize 2/2] RU  0.0s
 => CACHED [devcontainer dev_containers_target_stage 2/6] COPY --from=dev  0.0s
 => CACHED [devcontainer dev_containers_target_stage 3/6] RUN echo "_CONT  0.0s
 => CACHED [devcontainer dev_containers_target_stage 4/6] RUN --mount=typ  0.0s
 => ERROR [devcontainer dev_containers_target_stage 5/6] RUN --mount=type  7.4s
                                                                                
                                                                                
------
 > [devcontainer dev_containers_target_stage 5/6] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=java_1,target=/tmp/build-features-src/java_1     cp -ar /tmp/build-features-src/java_1 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/java_1  && cd /tmp/dev-container-features/java_1  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/java_1:
0.237 ===========================================================================
0.237 Feature       : Java (via SDKMAN!)
0.237 Description   : Installs Java, SDKMAN! (if not installed), and needed dependencies.
0.237 Id            : ghcr.io/devcontainers/features/java
0.237 Version       : 1.5.0
0.237 Documentation : https://github.com/devcontainers/features/tree/main/src/java
0.237 Options       :
0.237     VERSION="17"
0.237     ADDITIONALVERSIONS=""
0.237     JDKDISTRO="ms"
[2024-07-04T21:36:00.430Z] 0.237     INSTALLGRADLE="false"
0.237     GRADLEVERSION="latest"
0.237     INSTALLMAVEN="true"
0.237     MAVENVERSION="latest"
0.237     INSTALLANT="false"
0.237     ANTVERSION="latest"
0.237     INSTALLGROOVY="false"
0.237     GROOVYVERSION="latest"
0.237 ===========================================================================
7.354 Version 17 not found. Available versions:
7.354 
7.354 ERROR: Feature "Java (via SDKMAN!)" (ghcr.io/devcontainers/features/java) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/java for help troubleshooting this error.
------
[2024-07-04T21:36:00.430Z] failed to solve: process "/bin/sh -c cp -ar /tmp/build-features-src/java_1 /tmp/dev-container-features  && chmod -R 0755 /tmp/dev-container-features/java_1  && cd /tmp/dev-container-features/java_1  && chmod +x ./devcontainer-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/java_1" did not complete successfully: exit code: 1
[2024-07-04T21:36:00.438Z] Stop (8918 ms): Run: docker compose --project-name java22-springboot3-devcontainer_devcontainer -f /home/user/java22-springboot3-devcontainer/.devcontainer/docker-compose.yml -f /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1720128951520.yml build
[2024-07-04T21:36:00.439Z] Error: Command failed: docker compose --project-name java22-springboot3-devcontainer_devcontainer -f /home/user/java22-springboot3-devcontainer/.devcontainer/docker-compose.yml -f /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1720128951520.yml build
[2024-07-04T21:36:00.439Z]     at Km (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:430:525)
[2024-07-04T21:36:00.439Z]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-07-04T21:36:00.439Z]     at async QtA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:430:2476)
[2024-07-04T21:36:00.439Z]     at async utA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:410:3506)
[2024-07-04T21:36:00.439Z]     at async KtA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:482:3944)
[2024-07-04T21:36:00.439Z]     at async eB (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:482:4886)
[2024-07-04T21:36:00.440Z]     at async hrA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:662:13704)
[2024-07-04T21:36:00.440Z]     at async lrA (/home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js:662:13452)
[2024-07-04T21:36:00.450Z] Stop (12838 ms): Run: /usr/share/code/code /home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-9e6f1aef-ce08-4ea7-88e9-ff6a4be9a6d41720128946565 --workspace-folder /home/user/java22-springboot3-devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/user/java22-springboot3-devcontainer --id-label devcontainer.config_file=/home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-0e3a24b4-33b9-49c5-be8f-56b709045557.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2024-07-04T21:36:00.450Z] Exit code 1
[2024-07-04T21:36:00.455Z] Command failed: /usr/share/code/code /home/user/.vscode/extensions/ms-vscode-remote.remote-containers-0.375.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/user/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-9e6f1aef-ce08-4ea7-88e9-ff6a4be9a6d41720128946565 --workspace-folder /home/user/java22-springboot3-devcontainer --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/user/java22-springboot3-devcontainer --id-label devcontainer.config_file=/home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/user/java22-springboot3-devcontainer/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --remove-existing-container --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-0e3a24b4-33b9-49c5-be8f-56b709045557.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --include-configuration --include-merged-configuration
[2024-07-04T21:36:00.455Z] Exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants