microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.4k forks source link

The ability to specify an image variant in `args` seems to be removed #1680

Open GavinRay97 opened 1 year ago

GavinRay97 commented 1 year ago

Relates to: Both

I noticed something strange today after generating Devcontainer config for a project. The ability to specify the container image tag variant seems to be gone.

Previously when generating a C++ configuration, what I would get is this:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp
{
    "name": "C++",
    "build": {
        "dockerfile": "Dockerfile",
        // Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-11, debian-10, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
        // Use Debian 11, Ubuntu 18.04 or Ubuntu 22.04 on local arm64/Apple Silicon
        "args": { "VARIANT": "ubuntu-22.04" }
    },
    "runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],

    // Configure tool-specific properties.
    "customizations": {
        // Configure properties specific to VS Code.
        "vscode": {
            // Add the IDs of extensions you want installed when the container is created.
            "extensions": [
                "ms-vscode.cpptools",
                "ms-vscode.cmake-tools"
            ]
        }
    },

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],

    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "",

    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    //
    // NOTE: Commented to make "postCreateCommand" work, if not run as root it fails
    // "remoteUser": "vscode",
    "features": {
        "git": "latest",
        "python": "latest"
    }
}
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp/.devcontainer/base.Dockerfile
# [Choice] Debian / Ubuntu version (use Debian 11, Ubuntu 18.04/22.04 on local arm64/Apple Silicon): debian-11, debian-10, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}

However, today what I got was this, which is much less featureful and explanatory IMO:

{
    "name": "C++",
    "build": {
        "dockerfile": "Dockerfile"
    },

    // Use 'forwardPorts' to make a list of ports inside the container available locally.
    // "forwardPorts": [],

    // Use 'postCreateCommand' to run commands after the container is created.
    // "postCreateCommand": "gcc -v",

    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
    "remoteUser": "vscode",
    "features": {
        "ghcr.io/devcontainers/features/git:1": {},
        "ghcr.io/devcontainers/features/python:1": {}
    }
}
FROM mcr.microsoft.com/devcontainers/cpp:0-ubuntu-22.04

Why was the ability to specify the image variant as an ARG of the build removed from the Devcontainer JSON, out of curiosity?

jkeech commented 1 year ago

@GavinRay97 do you mind re-posting this on https://github.com/devcontainers/templates/issues, which is where the templates have moved to? This sounds like feedback on the cpp template: https://github.com/devcontainers/templates/tree/main/src/cpp