cli icon indicating copy to clipboard operation
cli copied to clipboard

Dockerfile for runing devcontainer/cli

Open AvishayHirsh opened this issue 3 months ago • 0 comments

I think it might be useful to share :

FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.18

RUN apk add --no-cache \
	nodejs \
	python3 \
	npm \
	make \
	g++ \
	docker-cli \
	docker-cli-buildx \
	docker-cli-compose \
	;

RUN npm i -g @devcontainers/cli

And then Build the Dockerfile:

docker build -t devcontainer-cli .

Running the CLI with mounting the Host docker daemon + mounting the workspace :

docker run -it --rm -v <LocalWorkspaceFoldr>:/workspaces -v /var/run/docker.sock:/var/run/docker.sock devcontainer-cli /bin/ash

I Referenced @chrmarti post which was an answer by him regarding some issue.

But i think it's worth to share this Dockerfile ( I Can submit a PR as well ) . of course one can imagine multiple usages and pros:

  1. In CI Pipeline where the host of the worker e.g Jenkins will run devcontainer/cli from within this Container based on above image.
  2. One that want to test devcontainer/cli without installing things on the machine

AvishayHirsh avatar Apr 13 '24 10:04 AvishayHirsh