Coder Social home page Coder Social logo

devcontainers / templates Goto Github PK

View Code? Open in Web Editor NEW
792.0 792.0 204.0 1.08 MB

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!

Home Page: https://containers.dev/templates

License: MIT License

Dockerfile 14.13% Shell 50.88% TSQL 0.04% Python 6.18% CMake 0.54% C++ 2.76% F# 0.59% C# 5.64% Go 1.61% Java 8.14% JavaScript 4.50% PHP 0.53% PowerShell 0.89% Rust 2.28% TypeScript 0.85% Batchfile 0.45%
containers devcontainers templates

templates's People

Contributors

abdulrabbani00 avatar bamurtaugh avatar chemingway avatar chrmarti avatar chuxel avatar dependabot[bot] avatar devcontainers-bot avatar eitsupi avatar ghiculescu avatar github-actions[bot] avatar jguadagno avatar johndowns avatar joshaber avatar joshspicer avatar jsta avatar marcusturewicz avatar peteryangio avatar plasma avatar sadika9 avatar samruddhikhandale avatar thomasowens avatar whuwxl avatar wxw-matt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

templates's Issues

[.NET] Add .NET Global tools to Path

.NET Global tools are increasingly used by .NET developers, and most notably by .NET developers doing data work (through Entity Framework or Polyglot Notebooks).

By default, when using .NET on linux, the folder containing the global tools is not added to the PATH. That's the case for dotnet-mssql or dotnet-postgres templates. This breaks core scenarios, like using Polyglot Notebooks extensions with SQL.

The solution is to add the .NET path to the PATH.

Note: it's also the case for dotnet template. However, this template has no Dockerfile, and I'm not sure using the postCreateCommand is an appropriate use.

No shell script in postCreateCommand possible ?!

Perhaps it depends on my Newby-state but i tried to start completely on a basic template with the normal php or php+mariadb container.

In postCreateCommand i defined a shell script and always on doing it online with github container i got a permission error (126) - on the local machine it works.

I googled a lot and found some alternative approaches but it does not solve my problem. How it would be possible to start a script with the original containers?

PS I could not understand why the marketing for VS Code with GitHub Codespaces is very "big" but the help files target only hardcore linux users. To make a team development in the cloud is a very good possibility for us but actually "i see no end" and i need really help to create a very basic container to run online and offline. The working samples here on github are between s start or very complete oversized. Therefore i try to do it myself but i have to stop because on the written basic error.

Thanks for a feedback.

Packages?

I can't see the packages from my account, is this normal?
(I'm wondering if they are set to public.)

image

Does the "platform" key mean anything?

unsure if this is the right spot to ask

https://github.com/devcontainers/templates/blob/main/src/java/devcontainer-template.json#L37
image

I see that sometimes it's "Any", and sometimes it's a tool or library, and sometimes it's a programming language?

All that's said in the docs is:
image

Basically, what I'm getting at is: do these keywords do anything in this example devcontainer-template.json file?

{
	"id": "jupyter-datascience-notebooks",
	"version": "1.0.0",
	"name": "Jupyter Data Science Notebooks",
	"description": "Use Jupyter Data Science Notebooks with Python, R, Julia, and more.",
	"documentationURL": "https://github.com/devcontainers-community/templates/tree/main/src/jupyter-datascience-notebooks",
	"publisher": "Community",
	"licenseURL": "https://github.com/devcontainers-community/templates/blob/main/LICENSE",
	"options": {
		"baseVariant": {
			"type": "string",
			"description": "Base image. Check the documentation for details.",
			"default": "datascience-notebook",
			"proposals": [
				"base-notebook",
				"minimal-notebook",
				"r-notebook",
				"scipy-notebook",
				"tensorflow-notebook",
				"datascience-notebook",
				"pyspark-notebook",
				"all-spark-notebook"
			]
		},
		"imageVariant": {
			"type": "string",
			"description": "Image version (tag).",
			"default": "latest",
			"proposals": ["latest"]
		}
	},
	"platforms": [
		"Python",
		"R",
		"Julia",
		"numpy",
		"pandas",
		"tidyverse",
		"much more"
	]
}

especially that "much more" 😆

Presence of Dockerfile in spec-provided Templates

Context

Before opening the dev container spec, we hosted a set of dev container Templates that each included a Dockerfile and devcontainer.json. Once we opened up the spec, we moved a set of Templates to this repo, and we made some changes, including having each Template only include a devcontainer.json in the .devcontainer folder (example).

Our goal was to make things simpler: you don't need to be a Dockerfile expert to use dev containers, and dev containers can be as simple as just a devcontainer.json referencing an image. The spec also still supports using a Dockerfile, so this change didn't break existing setups using a Dockerfile.

Problem

We've started seeing feedback (example) that the lack of Dockerfile (in this repo, or when running "Add Dev Container Configuration Files" in a supporting tool like VS Code or GitHub Codespaces) is confusing, with questions such as:

  • Are Dockerfiles supported by the dev container spec?
  • Has something changed (since the previous Templates had them)?
  • How do I add a Dockerfile?

Potential solutions

We added a comment in the Templates to try to help clarify: / Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile. But, we'd like to discuss making this an even clearer / easier process.

There are a few ways to address this, including:

  • Add Dockerfiles back to Templates in this repo
  • Add an option to "Add Dockerfile" in the "Add Dev Container Configuration Files" command flow in supporting tools
    • Could be a new step in the series of quick picks, or a checkbox in an existing step

Next steps

Share this issue with the community, including existing issues and our dev container community Slack channel, to get broader feedback.

Templates missing header information

Classily we've had two comments at the top to help people orient around using dev containers. First is a link to aka.ms/devcontainer.json, and another is to the README of the template. I think both of these should continue to be present. They were auto-added by the build system in the past.

e.g.

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node

dotnet:0-:imageVariant}: invalid reference format

Forgive me, I'm new to containers so I'm presuming I'm missing a key piece.

I've cloned this repo, and when I run devcontainer build --workspace-folder src/dotnet-mssql/ I get the following error:

[2208 ms] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/dotnet:0-:imageVariant}
[2492 ms] Parsed path 'devcontainers/dotnet:0-' for input 'mcr.microsoft.com/devcontainers/dotnet:0-:imagevariant}' failed validation.
[2492 ms] Error fetching image details: Could not parse image name 'mcr.microsoft.com/devcontainers/dotnet:0-:imageVariant}'
[2492 ms] Start: Run: docker pull mcr.microsoft.com/devcontainers/dotnet:0-:imageVariant}
invalid reference format
[2752 ms] []
[2752 ms] Error response from daemon: no such image: mcr.microsoft.com/devcontainers/dotnet:0-:imageVariant}: invalid reference format

{"outcome":"error","message":"Command failed: docker inspect --type image mcr.microsoft.com/devcontainers/dotnet:0-:imageVariant}","description":"An error occurred building the container."}

I can see imageVariant is an option in devcontainer-template.json, but it seems the default value isn't being picked up. I also don't see a way of setting the option.

Am I doing something wrong?

Provide more context on tool-specific properties

Currently most (all?) templates provide an entry for customizations similar to:

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

But new users to Codespaces and devcontainers.json specifically, do not understand how to add an extension or how that looks like. It would be useful to have either a link to documentation or a sample ID for a VSCode extension that could be used (or both).

The feature of right-clicking an extension and selecting "add to devcontainer.json" is incredibly useful but hardly used because there isn't awareness.

This issue in particular is brought forward based on feedback from students while learning to use Devcontainers for the first time.

Req: Dev Containers rebuild Postgres container

It doesn't seem possible to be able to use the Dev Container: Rebuild Container action to reset the database container. Which leaves going into Docker and deleting the db container from there. Also worth mentioning that the db volume should be deleted in the rebuild. :)

[Rust] Cargo cache persistence in Docker Volume

Do you think it is worth including in the template with the following settings, which share the Cargo cache between builds and containers, commented out?

{
	"source": "devcontainer-cargo-cache",
	"target": "/usr/local/cargo",
	"type": "volume"
}

Dockerfile missing?

It seems after v0.16x.x Dockerfiles are no longer included in the .devcontainer directory when using vscode's "Add devcontainer configuration files".
These are critical for installing extra packages and customizing the development environment.

Is there some new functionality that deprecates this way of working with devcontainers?

.
├── .devcontainer
│   └── devcontainer.json
|       <-- Dockerfile used to be here
├── package.json
└── src
    └── index.js

docker transparency workspace bind mounts

If you need to mount folders within the dev container into your own containers using docker-outside-of-docker and you do not want to use Docker in Docker to avoid a potential performance penalty.

This is possible by making use of the hosts local workspace value as bind mount location inside the container.

This is possible without making use of Docker in Docker to avoid performance penalties.

Like In GitHub Codespaces, the workspace folder is **available in the same place on the host as it is in the container,**so you can bind workspace contents as you would normally by doing as following:

DavidBerichon#1

[javascript-node-postgres] Invalid docker image

Hi,

I'm trying to get javascript-node-postgres working with codespaces, but container initialization is failing with the following message:

2023-01-26 00:17:22.182Z: Creating container...
2023-01-26 00:17:22.198Z: $ devcontainer up --id-label Type=codespaces --workspace-folder /var/lib/docker/codespacemount/workspace/postgres-pool --mount type=bind,source=/.codespaces/agent/mount/cache,target=/vscode --user-data-folder /var/lib/docker/codespacemount/.persistedshare --container-data-folder .vscode-remote/data/Machine --container-system-data-folder /var/vscode-remote --log-level trace --log-format json --update-remote-user-uid-default never --mount-workspace-git-root false --skip-non-blocking-commands --skip-post-create --expect-existing-container --config "/var/lib/docker/codespacemount/workspace/postgres-pool/.devcontainer/devcontainer.json" --override-config /root/.codespaces/shared/merged_devcontainer.json --default-user-env-probe loginInteractiveShell
2023-01-26 00:17:22.462Z: @devcontainers/cli 0.28.0. Node.js v14.21.2. linux 5.4.0-1100-azure x64.
2023-01-26 00:17:30.710Z: Error: The expected container does not exist.
2023-01-26 00:17:30.710Z:     at tie (/usr/lib/node_modules/@microsoft/vscode-dev-containers-cli/dist/spec-node/devContainersSpecCLI.js:1854:2097)
2023-01-26 00:17:30.710Z:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
2023-01-26 00:17:30.711Z:     at async Fie (/usr/lib/node_modules/@microsoft/vscode-dev-containers-cli/dist/spec-node/devContainersSpecCLI.js:1921:2266)
2023-01-26 00:17:30.711Z:     at async $f (/usr/lib/node_modules/@microsoft/vscode-dev-containers-cli/dist/spec-node/devContainersSpecCLI.js:1921:3239)
2023-01-26 00:17:30.711Z: {"outcome":"error","message":"The expected container does not exist.","description":"The expected container does not exist."}
2023-01-26 00:17:30.727Z:     at async eoe (/usr/lib/node_modules/@microsoft/vscode-dev-containers-cli/dist/spec-node/devContainersSpecCLI.js:2045:17247)
2023-01-26 00:17:30.728Z:     at async Qse (/usr/lib/node_modules/@microsoft/vscode-dev-containers-cli/dist/spec-node/devContainersSpecCLI.js:2045:16993)
2023-01-26 00:17:30.728Z: devcontainer process exited with exit code 1

In my project, I have the following files:

devcontainer.json

{
  "name": "postgres-pool",
  "dockerComposeFile": "docker-compose.yml",
  "service": "app",
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
  "customizations": {
    "vscode": {
      "extensions": [
        "EditorConfig.EditorConfig"
      ]
    }
  },
  "postCreateCommand": "npm install"
}

docker-compose.yml

version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile

    volumes:
      - ../..:/workspaces:cached

    # Overrides default command so things don't shut down after the process ends.
    command: sleep infinity

    # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
    network_mode: service:db

    # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
    # (Adding the "ports" property to this file will not forward from a Codespace.)

  db:
    image: postgres:latest
    restart: unless-stopped
    volumes:
      - postgres-data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
      POSTGRES_DB: postgres

    # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
    # (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
  postgres-data:

Dockerfile

FROM mcr.microsoft.com/devcontainers/javascript-node:0-18

I've verified that the javascript-node image exists as well as the postgres image. Any advice would be appreciated!

Ensure .NET dev container resources work well with latest C# Dev Kit

With the release of the C# Dev Kit, let's review the .NET Template (https://github.com/devcontainers/templates/tree/main/src/dotnet), Feature (https://github.com/devcontainers/features/tree/main/src/dotnet), and image (https://github.com/devcontainers/images/tree/main/src/dotnet).

Notes:

  • Install the C# Dev Kit extension
  • Try using the Template, Feature, and image with the C# Dev Kit's commands and ensure everything works well
  • Investigate including any other Features in the image or template, such as PowerShell and all the necessary .NET SDKs

Python & Postgres template builds, but fails to start

Best I can tell it tries to download the fre3shly built image from some registry, which unsurprisingly fails. I'm using version: '3.7' in the docker-compose.yml because '3.8' immediately fails. I assume my docker/docker-compose is too old.

[2022-12-13T15:28:37.882Z] Successfully built e0dfa4ed8671
[2022-12-13T15:28:38.836Z] Successfully tagged operations_devcontainer_app:latest
[2022-12-13T15:28:39.287Z] Stop (856181 ms): Run: docker-compose --project-name operations_devcontainer -f /home/pabernet/Code/operations/.devcontainer/docker-compose.yml -f /home/pabernet/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1670944463105.yml build --no-cache
[2022-12-13T15:28:39.290Z] Start: Run: docker inspect --type image operations_devcontainer_app
[2022-12-13T15:28:42.657Z] Stop (3367 ms): Run: docker inspect --type image operations_devcontainer_app
[2022-12-13T15:28:43.990Z] Error fetching image details: No manifest found for docker.io/library/operations_devcontainer_app.
[2022-12-13T15:28:43.990Z] Start: Run: docker pull operations_devcontainer_app
[2022-12-13T15:28:46.033Z] Using default tag: latest
[2022-12-13T15:28:46.708Z] Error response from daemon: pull access denied for operations_devcontainer_app, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
[2022-12-13T15:28:46.716Z] Stop (2726 ms): Run: docker pull operations_devcontainer_app
[2022-12-13T15:28:46.716Z] []
[2022-12-13T15:28:46.716Z] Error: No such image: operations_devcontainer_app

[2022-12-13T15:28:46.718Z] Error: Command failed: docker inspect --type image operations_devcontainer_app
[2022-12-13T15:28:46.718Z]     at loe (/home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1832:2820)
[2022-12-13T15:28:46.718Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-12-13T15:28:46.718Z]     at async Poe (/home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:2301)
[2022-12-13T15:28:46.719Z]     at async Zf (/home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:3278)
[2022-12-13T15:28:46.719Z]     at async aue (/home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15276)
[2022-12-13T15:28:46.719Z]     at async oue (/home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15030)
[2022-12-13T15:28:46.871Z] Stop (874977 ms): Run: /snap/code/114/usr/share/code/code --ms-enable-electron-run-as-node /home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/pabernet/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /home/pabernet/Code/operations --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/pabernet/Code/operations --log-level debug --log-format json --config /home/pabernet/Code/operations/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --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-12-13T15:28:46.872Z] Exit code 1
[2022-12-13T15:28:46.874Z] Command failed: /snap/code/114/usr/share/code/code --ms-enable-electron-run-as-node /home/pabernet/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/pabernet/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /home/pabernet/Code/operations --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/pabernet/Code/operations --log-level debug --log-format json --config /home/pabernet/Code/operations/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --build-no-cache --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-12-13T15:28:46.874Z] Exit code 1

Creating a new Jekyll dev container leads to duplication in post create step

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.73.1
  • OS Version: CentOS 7

Steps to Reproduce:

  1. Execute "Create Dev Container" command
  2. Select Jekyll

Reported by @tudortimi in microsoft/vscode-remote-release#7948:

The command will create a devcontainer.json with the following content:

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

	// 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": [
		// Jekyll server
		4000,
		// Live reload server
		35729
	],

	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "sh .devcontainer/post-create.sh"

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

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

and a post-create.sh:

#!/bin/sh

# Install the version of Bundler.
if [ -f Gemfile.lock ] && grep "BUNDLED WITH" Gemfile.lock > /dev/null; then
    cat Gemfile.lock | tail -n 2 | grep -C2 "BUNDLED WITH" | tail -n 1 | xargs gem install bundler -v
fi

# If there's a Gemfile, then run `bundle install`
# It's assumed that the Gemfile will install Jekyll too
if [ -f Gemfile ]; then
    bundle install
fi

Newer versions of the Jekyll dev container already contain the settings for postCreateCommand (and in port forwarding) - the entry in the JSON and the script. The generated setup results in the bundler commands being executed twice.

dotnet-postgres - webapi "dotnet watch run" Failed to determine the https port for redirect.

When running "dotnet watch run" from the container terminal inside of a dotnet7 webapi template you get the below error.

How to reproduce

  1. Create new dev container for dotnet-postgres with no additional features.
  2. Open dev container terminal
  3. run dotnet new webapi -o testapi
  4. cd testapi
  5. run dotnet watch run
  6. Open browser and go to listed localhost address

You will then see the following error
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect.

Base OS: Arch Linux

Docker Info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., 0.9.1)
compose: Docker Compose (Docker Inc., 2.14.2)
scan: Docker Scan (Docker Inc., v0.1.0-271-g6c852fac62)

Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 8
Server Version: 20.10.22
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9ba4b250366a5ddde94bb7c9d1def331423aa323.m
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
cgroupns
Kernel Version: 6.1.7-1-MANJARO
Operating System: Manjaro Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 23.26GiB
Name: shane-laptop
ID: W55L:GLVC:D6X5:WTRI:4UFT:WNKE:QLM3:763G:3CJW:JEEP:H2DE:6TKI
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

WASM Templates

Since Docker now supports WASM as alternative to Linux Container, Could WASM Templates be supported as they are lightweight and have faster cold start? It may be suited for devcontainers.

Is "docker-in-docker" template correct?

When I created an environment by selecting "Docker in Docker" in "Add Dev Container Configuration Files" in VS Code, the template created the devcontainer.json below that has docker-from-docker in features.

In the environment, the docker engine shows its instance when running docker ps. It looks like "docker-from-docker" behavior, not "docker-in-docker'.

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
{
	"name": "Docker in Docker",
	"image": "mcr.microsoft.com/devcontainers/base:bullseye",
	"features": {
		"ghcr.io/devcontainers/features/common-utils:1": {
			"installZsh": "true",
			"upgradePackages": "false",
			"uid": "1000",
			"gid": "1000",
			"installOhMyZsh": "true",
			"nonFreePackages": "true"
		},
		"ghcr.io/devcontainers/features/docker-from-docker:1": {
			"version": "latest",
			"enableNonRootDocker": "true",
			"moby": "true"
		}
	}

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

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

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

So, I changed from docker-from-docker to docker-in-docker inside features configuration, then the behavior is suited to my thought.

What do you think?

Thank you for these convenient templates!

Best regards,

[go][bash][vscode-extensions] local cache and history persistence without volumes

Hello,

I find that in some case you may prefer to persist your build caches, bash history, etc... inside a local folder instead of inside a volume.

The following approach keeps a subset of cache or history in each project on the local disk.

requirements:

  • For this feature you will have to mount your project inside your devcontanier at the same position as it is on your host.
  • This is mandatory to not lose the data if the devcontainer is rebuild.
  • Thus, if the devcontainer is destroyed or rebuilt or if the docker volumes are removed the project specific build caches and bash history data will not be lost. They will still be

use onCreateCmd:

Add the following in .devcontainer/devcontainers.json:

    "onCreateCommand": ".devcontainer/on-create-cmd.sh",

And now create a script .devcontainer/on-create-cmd.sh:

#!/bin/sh

set -e

sudo chmod o+rw /var/run/docker.sock

rm -rf ${HOME}/.bash_history
touch ${PWD}/.devcontainer/bash_history
ln -s ${PWD}/.devcontainer/bash_history ${HOME}/.bash_history

sudo rm -rf /go
mkdir -p ${PWD}/.devcontainer/go
sudo ln -s ${PWD}/.devcontainer/go /go

mkdir -p ~/.cache
sudo rm -rf ~/.cache/go-build
mkdir -p ${PWD}/.devcontainer/go-build-cache
sudo ln -s ${PWD}/.devcontainer/go-build-cache ~/.cache/go-build

# Vscode Remote-Container extension uses 'vscode-remote'
if [ -d ~/.vscode-server ] ; then
    rm -rf ~/.vscode-server/extensions
    mkdir -p ${PWD}/.devcontainer/vscode-extensions ~/.vscode-server
    ln -s ${PWD}/.devcontainer/vscode-extensions ~/.vscode-server/extensions
fi

# Github Codespaces uses 'vscode-remote'
if [ -d ~/.vscode-remote ] ; then
    rm -rf ~/.vscode-remote/extensions
    mkdir -p ${PWD}/.devcontainer/vscode-extensions ~/.vscode-remote
    ln -s ${PWD}/.devcontainer/vscode-extensions ~/.vscode-remote/extensions
fi

Do not forget to add execution rights for your script:

chmod +x .devcontainer/on-create-cmd.sh

Result inside the devcontainer

image

gitignore

As you can see now the project go build caches, vscode-extensions and bash history are generated inside the project path itself on your local disk.

I recommend that you finally add the following lines to .devcontainer/.gitignore to keep those file from versioning:

go
go-build-cache
bash_history
vscode-extensions

Working example:

You can view a working example of this on one of my personal test project: https://github.com/7d4b9/utrade/tree/dev/.devcontainer

Just open a Codespace container directly on GitHub or checkout the project locally to use your host.

Github Codespace

Keep in mind that here the persistence will occur in the current project checkout host. As it is a VM the data may be lost if this host is changed. However this is changing nothing as it is also the case if the data were kept inside a docker volume if the docker instance is renewed. So this is not a real warn, just an observation :)

`docker-compose up` fails in templates/src/cpp-mariadb/.devcontainer/

Should running docker-compose up work in the .devcontainer folder?

The following error is generated using using code in the templates repository under templates/src/cpp-mariadeb/.devcontainer.

C:\code\microsoft\cpp-mariadb.devcontainer>docker-compose up
[+] Building 0.1s (2/2) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.26kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to process "mcr.microsoft.com/devcontainers/cpp:0-${templateOption:imageVariant}": unsupported modifier (i) in substitution

The following error is generated using the template "C++ & MariaDB" from the devcontainers extension - VS Code v1.77.3, Dev Containers v0.288.1.

C:\code\test\cpp-mariadb.devcontainer>docker-compose up
[+] Building 0.7s (8/10)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.22kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for mcr.microsoft.com/devcontainers/cpp:0-debian-11 0.2s
=> [1/6] FROM mcr.microsoft.com/devcontainers/cpp:0-debian-11@sha256:0605a13ffcd3d6d437e55129e93c5d650b8a6c9477d 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 78B 0.0s
=> CACHED [2/6] RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y install curl 0.0s
=> [3/6] COPY ./install-mariadb.sh /tmp/ 0.0s
=> ERROR [4/6] RUN chmod +x /tmp/install-mariadb.sh && /tmp/install-mariadb.sh && rm -f /tmp/install-mariadb.sh 0.4s

[4/6] RUN chmod +x /tmp/install-mariadb.sh && /tmp/install-mariadb.sh && rm -f /tmp/install-mariadb.sh:
#0 0.346 /bin/sh: 1: /tmp/install-mariadb.sh: not found


failed to solve: executor failed running [/bin/sh -c chmod +x /tmp/install-mariadb.sh && /tmp/install-mariadb.sh && rm -f /tmp/install-mariadb.sh]: exit code: 127

Working example?

Is there a working example of a project that uses the CPP template?

The following workflow would be really helpful:

  • Open Visual Studio Code
  • Press F1
  • Select Dev Containers: New Dev Container
  • Enter a project name
  • Select Create Dev Container
  • Select Run > Start Debugging

The application would compile, run, and display "Hello World!".

The result would be:

  • A Docker image that includes everything needed for basic C++ development and can be easily extended to add more libraries or tools as needed.
  • Code that you can execute and also step through for debugging.
  • Integration with the IDE for IntelliSense.
  • Git support.
  • Use of a Docker Volume for increased I/O performance.

Bonus points for including a description of the workflow for checking out the code, making changes to it, running and stepping through the code, and then saving changes back into Git.

Thanks in advance for any example you have or help creating something like this. I'm happy to create a Pull Request to add if that helps.

-Ed

Is there a way to set a proxy for the actions set in ``feature``?

When adding a development container, the following devcontainer.json was added.

{
	"name": "Python 3",
	"image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye",
	"features": {
		"ghcr.io/devcontainers/features/node:1": {
			"version": "lts"
		}
	},

	// 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": "pip3 install --user -r requirements.txt",

	// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "vscode"
}

When I start the development container under the proxy environment, I get the following error.

[2022-11-04T02:46:16.377Z]  ---> Running in cb3df42a48be
[2022-11-04T02:46:16.724Z] ===========================================================================
Feature       : Node.js (via nvm) and yarn
Description   : Installs Node.js, nvm, yarn, and needed dependencies.
Id            : ghcr.io/devcontainers/features/node
Version       : 1.1.1
Documentation : https://github.com/devcontainers/features/tree/main/src/node
Options       :
    VERSION="lts"
    NODEGYPDEPENDENCIES="true"
    NVMINSTALLPATH="/usr/local/share/nvm"
    NVMVERSION="0.39.2"
===========================================================================
[2022-11-04T02:46:16.822Z] Yarn already installed.
[2022-11-04T02:46:16.856Z] NVM already installed.
[2022-11-04T02:49:52.504Z] Version '' (with LTS filter) not found - try `nvm ls-remote --lts` to browse available versions.
[2022-11-04T02:49:52.507Z] ERROR: Feature "Node.js (via nvm) and yarn" (ghcr.io/devcontainers/features/node) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/node for help troubleshooting this error.
[2022-11-04T02:49:52.684Z] The command '/bin/sh -c cd /tmp/build-features/node_1 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh' returned a non-zero code: 3
[2022-11-04T02:49:52.689Z] Stop (216570 ms): Run: docker build --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/python:3.10-bullseye --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-ms-identity-javascript-react-spa-1693c68eb136e712db187f2bdf7e772d-features -f /tmp/devcontainercli-ubuntu/container-features/0.23.2-1667529973984/Dockerfile.extended /tmp/devcontainercli-ubuntu/empty-folder
[2022-11-04T02:49:52.687Z] Error: Command failed: docker build --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/python:3.10-bullseye --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-ms-identity-javascript-react-spa-1693c68eb136e712db187f2bdf7e772d-features -f /tmp/devcontainercli-ubuntu/container-features/0.23.2-1667529973984/Dockerfile.extended /tmp/devcontainercli-ubuntu/empty-folder
[2022-11-04T02:49:52.687Z]     at loe (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1339)
[2022-11-04T02:49:52.688Z]     at eT (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1887:1275)
[2022-11-04T02:49:52.688Z]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-11-04T02:49:52.688Z]     at async voe (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:2049)
[2022-11-04T02:49:52.689Z]     at async Xf (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:3212)
[2022-11-04T02:49:52.689Z]     at async Jae (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:15058)
[2022-11-04T02:49:52.689Z]     at async Wae (/home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:14812)
[2022-11-04T02:49:52.692Z] Stop (219084 ms): Run in Host: /home/ubuntu/.vscode-remote-containers/bin/8fa188b2b301d36553cbc9ce1b0a146ccb93351f/node /home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --log-level debug --log-format json --config /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa/.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-11-04T02:49:52.692Z] Exit code 1
[2022-11-04T02:49:52.704Z] Command failed: /home/ubuntu/.vscode-remote-containers/bin/8fa188b2b301d36553cbc9ce1b0a146ccb93351f/node /home/ubuntu/.vscode-remote-containers/dist/dev-containers-cli-0.262.3/dist/spec-node/devContainersSpecCLI.js up --workspace-folder /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa --log-level debug --log-format json --config /home/ubuntu/ghq/github.com/ksaito1125/ms-identity-javascript-react-spa/.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-11-04T02:49:52.704Z] Exit code 1

Looking at the log, I noticed that docker build did not have a proxy set with --build-arg.

[2022-11-04T02:46:14.041Z] * Processing feature: ghcr.io/devcontainers/features/node:1
[2022-11-04T02:46:14.634Z] * Fetching feature: node_1_oci
[2022-11-04T02:46:15.277Z] Start: Run: docker build -t dev_container_feature_content_temp -f /tmp/devcontainercli-ubuntu/container-features/0.23.2-1667529973984/Dockerfile.buildContent /tmp/devcontainercli-ubuntu/container-features/0.23.2-1667529973984
[2022-11-04T02:46:15.382Z] Sending build context to Docker daemon  328.2kB

Is there a way to set a proxy for the actions set in feature?

docker-outside-of-docker: compose and other cli-plugins

The "docker-outside-of-docker" feature template works as expected and I can use the docker cli with access to the host docker.sock inside my devcontainer. But I quickly ran into the problem of the cli not knowing any "docker compose [...]" commands.

To my knowledge, all docker commands with an * are optional plugins for the cli:

host system:

Management Commands:
  builder     Manage builds
  buildx*     Docker Buildx (Docker Inc., v0.10.3)
  compose*    Docker Compose (Docker Inc., v2.15.1)
  config      Manage Docker configs
  container   Manage containers
  context     Manage contexts
  dev*        Docker Dev Environments (Docker Inc., v0.1.0)
  extension*  Manages Docker extensions (Docker Inc., v0.2.18)
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  sbom*       View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan*       Docker Scan (Docker Inc., v0.25.0)
  scout*      Command line tool for Docker Scout (Docker Inc., v0.6.0)
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

devcontainer:

Management Commands:
  builder     Manage builds
  buildx*     Docker Buildx (Docker Inc., v0.10.4)
  container   Manage containers
  context     Manage contexts
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  plugin      Manage plugins
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

I'm going to add a manual install for this in my devcontainer dockerfile (based on this) but is there not any easier way using this feature-template?
Could a "plugins": [ "compose", ... ] option be added, or something like that?

Kubernetes - Local Configuration (kubernetes-helm) doesn't work on Windows

When using the "Kubernetes - Local Configuration" (kubernetes-helm) Dev Container Template on Windows, an error occurs.

Example of Error:

[67 ms] Dev Containers 0.266.1 in VS Code 1.74.3 (97dec172d3256f8ca4bfb2143f3f76b503ca0534).
[66 ms] Start: Resolving Remote
[89 ms] Setting up container for folder or workspace: c:\path\to\project
[93 ms] Start: Check Docker is running
[94 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[417 ms] Server API version: 1.41
[419 ms] Start: Run: docker volume ls -q
[840 ms] Start: Run: docker ps -q -a --filter label=vsch.local.folder=c:\path\to\project --filter label=vsch.quality=stable
[1157 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\path\to\project
[1506 ms] Start: Run: C:\Users\username\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\username\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\path\to\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\path\to\project --log-level debug --log-format json --config c:\path\to\project\.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
[1751 ms] (node:26548) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[1751 ms] (Use `Code --trace-deprecation ...` to show where the warning was created)
[1754 ms] @devcontainers/cli 0.25.2. Node.js v16.14.2. win32 10.0.22000 x64.
[1754 ms] Start: Run: docker buildx version
[2715 ms] github.com/docker/buildx v0.10.0 876462897612d36679153c3414f7689626251501
[2716 ms] 
[2716 ms] Start: Resolving Remote
[2719 ms] Start: Run: git rev-parse --show-cdup
Running the initializeCommand from devcontainer.json...

[2843 ms] Start: Run: C:\WINDOWS\system32\cmd.exe /c cd .devcontainer && bash ensure-mount-sources
"Ensuring mount points exist..."
A subdirectory or file C:\Users\username\.kube already exists.
A subdirectory or file C:\Users\username\.minikube already exists.

[3283 ms] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=c:\path\to\project
[3654 ms] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/base:bullseye
[3968 ms] local container features stored at: c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\node_modules\vscode-dev-containers\container-features
[3970 ms] Start: Run: tar --no-same-owner -x -f -
[4224 ms] * Processing feature: ghcr.io/devcontainers/features/docker-outside-of-docker:1
[4825 ms] * Processing feature: ghcr.io/devcontainers/features/kubectl-helm-minikube:1
[5334 ms] * Processing feature: ./local-features/copy-kube-config
[5334 ms] Local disk feature.
[5334 ms] Local file path parse error. Resolved path must be a child of the .devcontainer/ folder.  Parsed: \c:\path\to\project\.devcontainer\local-features\copy-kube-config
[5336 ms] Error: Failed to process feature ./local-features/copy-kube-config
[5336 ms]     at Pse (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1805:3150)
[5336 ms]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[5336 ms]     at async Sm (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1805:2294)
[5336 ms]     at async Jf (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1807:1415)
[5336 ms]     at async Pm (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1807:308)
[5336 ms]     at async EF (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1893:2016)
[5336 ms]     at async uT (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1893:901)
[5336 ms]     at async Poe (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:2128)
[5336 ms]     at async Zf (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:3278)
[5336 ms]     at async aue (c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15276)
[5347 ms] Exit code 1
[5350 ms] Command failed: C:\Users\username\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\username\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\username\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\path\to\project --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\path\to\project --log-level debug --log-format json --config c:\path\to\project\.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
[5350 ms] Exit code 1

Jekyll Container not completing setup

There is currently an error with the Jekyll-Container, where it fails to be fetched on "docker inspect —-type image…".

This seems to be due to a server-side error per, suggested by the point-of-error along with, the fact that four other containers are working on my machine.

P.S. I suspect it’s a URL-error. I just ran a lookup of both the Dotnet-URL and Jekyll-URL, the Dotnet responded and the Jekyll did not.

Writing a VSCode extension, want to enable "Attach Visual Studio Code" to kubectl pod

Hi there!

I'm writing a VSCode extension and want to be able to add an "Attach Visual Studio Code" to a Kubectl pod button to my UI. I want to build an experience that closely matches this Kubernetes demo (but with my own custom list of pods). However, after a few days looking through this repo, I'm still struggling to find how to implement this.

Screenshot from Kubernetes demo is here: k8s-attach

I'd be really grateful if you could either point me towards a tutorial for setting this up, or if you could explain the steps that would be great.

Thanks!
Ben

Mac M1 ARM64 DevContainers

I attempted to build the following devcontainer (from Dockerfile):

FROM mcr.microsoft.com/devcontainers/go:0-1.19-buster

which returned the following error:

[6671637 ms] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/go:0-1.19-buster
[6672523 ms] Error fetching image details: No manifest found for mcr.microsoft.com/devcontainers/go:0-1.19-buster.
[6672524 ms] Start: Run: docker pull mcr.microsoft.com/devcontainers/go:0-1.19-buster
0-1.19-buster: Pulling from devcontainers/go
no matching manifest for linux/arm64/v8 in the manifest list entries
[6674135 ms] []
[6674135 ms] Error: No such image: mcr.microsoft.com/devcontainers/go:0-1.19-buster

I noticed in some of the doc's - it mentions that you should use bullseye for ARM 64 - which did seem to work successfully. Just checking this is "as designed".

Templates do not include the major version prefix

To put people on the right path and avoid breaking changes, templates should reference a major version of the image. e.g. base:0-bullseye not base:bullseye,

This was automated in vscode-dev-containers but is not here.

Alpine devcontainers don't support PHP feature

Hi,

When setting up a new devcontainer using the Add Dev Container Configuration files option.

I have opted to setup an Alpine devcontainer for PHP
however the image fails to build:

Command failed: /usr/share/code/code --ms-enable-electron-run-as-node /home/<REDACTED>/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/<REDACTED>/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-569571c6-7fb5-4cb2-9fdf-6985555bc89a1684146291461 --workspace-folder /home/<REDACTED>/Projects/<REDACTED> --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/<REDACTED>/Projects/<REDACTED> --id-label devcontainer.config_file=/home/<REDACTED>/Projects/<REDACTED>/.devcontainer/devcontainer.json --log-level debug --log-format json --config /home/<REDACTED>/Projects/<REDACTED>/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=/run/user/1000/wayland-0,target=/tmp/vscode-wayland-988ce2e2-223e-46a3-8e68-5d30ba0c8eaf.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true

Ruby on Rails & Postgres Devcontainer Template is not configured for immediate running

When I create a new set of devcontainer configuration files using the default Ruby on Rails & Postgres configuration, I would expect to be able to launch the container and execute rails new . -d postgresql without errors. The Rails project files are laid out properly, but one of the steps in instantiating a new Rails project is to install the relevant gems. This step fails.

Many errors of the following nature come up:

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to /usr/local/rvm/gems/default/cache/bindex-0.8.1.gem. It is likely that you need to grant write permissions for that path.

This also prevents the default postCreateCommand from running, if that is uncommented, since that command runs bundle install.

The general solution is to set the bundle directory to be something within the workspace. One specific solution is to set the BUNDLE_PATH environment variable to something in the workspace within the devcontainer.json file:

"containerEnv": {
		"BUNDLE_APP_CONFIG": "/workspaces/${localWorkspaceFolderBasename}/.bundle",
		"BUNDLE_PATH": "/workspaces/${localWorkspaceFolderBasename}/vendor/bundler"
}

There may be better solutions, though, that are more generic.

dotnet-mssql on Mac M1 support missing

The current template dotnet-mssql does not work on a Mac with the M1 processor. You can install azure-sql-edge but the mssql-tools do not support that image.

Miniconda Python 3 Devcontainer - Permission Denied

Hello! I've been trying to develop with the miniconda devcontainer and have run into Permission Denied errors on initialization.

Recreate

  1. Open an empty folder in VSCode
  2. Reopen in Container > "Miniconda (Python 3)" > no features

It seems that there is a permission error deleting /tmp/conda-tmp in line 7 of the Dockerfile, and this affect projects both with and without an environment.yml.
https://github.com/devcontainers/templates/blob/main/src/miniconda/.devcontainer/Dockerfile#L6-L7C29

Interestingly, there is no issue when I use the anaconda devcontainer.

Here is a sample of the error log when I open the devcontainer without an environment.yml:

[2023-05-09T15:58:53.494Z]  => [dev_container_auto_added_stage_label 2/3] COPY environment.yml* .dev  0.1s
 => ERROR [dev_container_auto_added_stage_label 3/3] RUN if [ -f "/tmp/co  0.4s
------
 > [dev_container_auto_added_stage_label 3/3] RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi     && rm -rf /tmp/conda-tmp:
#0 0.343 rm: cannot remove '/tmp/conda-tmp/noop.txt': Permission denied
------
[2023-05-09T15:58:53.496Z] Dockerfile-with-features:8
[2023-05-09T15:58:53.508Z] 
--------------------
   7 |     COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
   8 | >>> RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
   9 | >>>     && rm -rf /tmp/conda-tmp
  10 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c if [ -f \"/tmp/conda-tmp/environment.yml\" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi     && rm -rf /tmp/conda-tmp" did not complete successfully: exit code: 1
[2023-05-09T15:58:53.517Z] Stop (882 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-joshua/container-features/0.40.0-1683647932612/Dockerfile-with-features -t vsc-miniconda-test-c11d0cef61eb803f5f102413a7ecf9a90c41929cdeff7f00ca3504e3739142d9 --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /home/joshua/test/miniconda-test
[2023-05-09T15:58:53.436Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-joshua/container-features/0.40.0-1683647932612/Dockerfile-with-features -t 

Fixes

I've just been using the anaconda devcontainer in the meantime, although it is quite a bit bigger (5GB compared to 1.58)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.