devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
859 stars 226 forks source link

I am a greener. Just ask a simple question about the toolchain in the container. #243

Closed lmmqxyx404 closed 4 months ago

lmmqxyx404 commented 4 months ago
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
    "name": "Rust",
    // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
    "image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye"

    // Use 'mounts' to make the cargo cache persistent in a Docker Volume.
    // "mounts": [
    //  {
    //      "source": "devcontainer-cargo-cache-${devcontainerId}",
    //      "target": "/usr/local/cargo",
    //      "type": "volume"
    //  }
    // ]

    // Features to add to the dev container. More info: https://containers.dev/features.
    // "features": {},

    // 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": "rustc --version",

    // Configure tool-specific properties.
    // "customizations": {},

    // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
    // "remoteUser": "root"
}

I had added the rust dev container. But I stiil need a cmake. How can I add the cmake? And if I want to upgrade the rust version, What can I do ?

samruddhikhandale commented 4 months ago

Hello 👋

And if I want to upgrade the rust version, What can I do ?

We try to keep the mcr.microsoft.com/devcontainers/rust:1-1-bullseye image up-to-date. However, you can install another version of rust with the Rust Feature.

Feel free to look at https://containers.dev/ for more information.

But I stiil need a cmake. How can I add the cmake?

You can use a Dockerfile instead with the following contents and point the devcontainer.json to use it (ie In your devcontainer.json file, make sure to set "dockerfile": "Dockerfile" to use the Dockerfile you just created). Read more at https://containers.dev/guide/dockerfile

FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye

# Install CMake
RUN apt-get update && \
    apt-get -y install cmake