Base development container for Visual Studio Code, used as base image by other images
2.1K
Base Alpine development container for Visual Studio Code, used as base image by other images
qmcgaw/basedevcontainer:alpine (or :latest) based on Alpine 3.19 in 230MBqmcgaw/basedevcontainer:debian based on Debian Buster Slim in 376MBamd64, 386, arm64, armv7, armv6 and ppc64le CPU architectureslibstdc++: needed by the VS code serverzsh: main shell instead of /bin/shgit: interact with Git repositoriesopenssh-client: use SSH keysnano: edit files from the terminalgh: interact with Github with the terminaldockerdocker-compose and docker compose docker plugindocker buildx docker pluginbitdevtainrls
~/.ssh and the directory of your project with Docker DesktopDownload this repository and put the .devcontainer directory in your project.
Alternatively, use this shell script from your project path
# we assume you are in /yourpath/myproject
mkdir .devcontainer
cd .devcontainer
wget -q https://raw.githubusercontent.com/iznth/basedevcontainer/master/.devcontainer/devcontainer.json
wget -q https://raw.githubusercontent.com/iznth/basedevcontainer/master/.devcontainer/docker-compose.yml
If you have a .vscode/settings.json, eventually move the settings to .devcontainer/devcontainer.json in the "settings" section as .vscode/settings.json take precedence over the settings defined in .devcontainer/devcontainer.json.
Open the command palette in Visual Studio Code (CTRL+SHIFT+P) and select Remote-Containers: Open Folder in Container... and choose your project directory
"postCreateCommand" to be relevant to your situation. In example it could be echo "downloading" && npm i to combine two commands"extensions" array"settings" object.Add this block to .devcontainer/docker-compose.yml
database:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: password
In .devcontainer/devcontainer.json change the line "runServices": ["vscode"], to "runServices": ["vscode", "database"],
In the VS code command palette, rebuild the container
You can build and extend the Docker development image to suit your needs.
You can build the development image yourself:
docker build -t qmcgaw/basedevcontainer -f alpine.Dockerfile https://github.com/iznth/basedevcontainer.git
You can extend the Docker image qmcgaw/basedevcontainer with your own instructions.
Create a file .devcontainer/Dockerfile with FROM qmcgaw/basedevcontainer
Append instructions to the Dockerfile created. For example:
Add more Go packages and add an alias
FROM qmcgaw/basedevcontainer
COPY . .
RUN echo "alias ls='ls -al'" >> ~/.zshrc
Add some Alpine packages, you will need to switch to root:
FROM qmcgaw/basedevcontainer
USER root
RUN apk add bind-tools
USER vscode
Modify .devcontainer/docker-compose.yml and add build: . in the vscode service.
Open the VS code command palette and choose Remote-Containers: Rebuild container
You can bind mount a file at /home/vscode/.welcome.sh to modify the welcome message (use /root/.welcome.sh for root)
bit complete yes flagContent type
Image
Digest
sha256:cec6c222c…
Size
81.3 MB
Last updated
over 2 years ago
docker pull iznth/baseddevcontainer