-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added "docker outside of docker" devcontainer (#2316)
* added dood devcontainer * use file paths * mandatorize clab version during the build and add runargs * added tag munching step * fucking actions * bring back config * run devcontainer build on beta tags as well * try lowercase * output tag * move outputs * a day when you hate gh actions * change name * remove test * added needs deps * trying slim dockerfile for devcontainer * use slim zshrc * use explicit suffixes * change devcontainer base name * bring back moby for version matching * try 26.1.4 * try 25.0.5 * try 24 * switch to 26.1.5 and wait for better times moby/moby#48987 * try moby 27.3.1 * try 26.1.3 * try 23.0.7 * try 26.1.4 docker * do not install docker-compose plugin * installDockerComposeSwitch false * bring back 23.0.7 fucking containers man * remove utm docs and finish dind/dood docs * added a video * test fira code embedded and zsh term settings * remove font download and set multiple fonts * added devcontainer requirements * do not require icons in the fonts * added windows install doc * fix bg color in animation * note about the reboot
- Loading branch information
Showing
16 changed files
with
686 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"build": { | ||
"dockerfile": "../slim.Dockerfile", | ||
"context": "../..", | ||
"args": { | ||
"CLAB_VERSION": "${localEnv:CLAB_VERSION}" | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
"version": "23.0.7", | ||
"dockerDashComposeVersion": "none", | ||
"installDockerComposeSwitch": "false" | ||
}, | ||
// Add sshd to support gh cli codespace cp. | ||
"ghcr.io/devcontainers/features/sshd:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
"remoteUser": "vscode", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/bin/zsh" | ||
} | ||
}, | ||
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace" | ||
}, | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker", | ||
// Python. | ||
"ms-python.python", | ||
// Errors and highlighters. | ||
"mechatroner.rainbow-csv", | ||
"redhat.vscode-yaml", | ||
// markdown | ||
"yzhang.markdown-all-in-one", | ||
"davidanson.vscode-markdownlint" | ||
] | ||
} | ||
}, | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/${containerWorkspaceFolder},type=bind", | ||
"workspaceFolder": "/clab" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"build": { | ||
"dockerfile": "../Dockerfile", | ||
"context": "../..", | ||
"args": { | ||
"CLAB_VERSION": "${localEnv:CLAB_VERSION}" | ||
} | ||
}, | ||
"runArgs": [ | ||
"--network=host", | ||
"--pid=host", | ||
"--privileged" | ||
], | ||
"mounts": [ | ||
"type=bind,src=/run/docker/netns,dst=/run/docker/netns", | ||
"type=bind,src=/var/lib/docker,dst=/var/lib/docker", | ||
"type=bind,src=/lib/modules,dst=/lib/modules" | ||
], | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": { | ||
"version": "23.0.7", | ||
"dockerDashComposeVersion": "none", | ||
"installDockerComposeSwitch": "false" | ||
}, | ||
// Add sshd to support gh cli codespaces cp. | ||
"ghcr.io/devcontainers/features/sshd:1": { | ||
"version": "latest" | ||
}, | ||
"ghcr.io/devcontainers/features/go:1": { | ||
"version": "1.22" | ||
} | ||
}, | ||
"remoteUser": "vscode", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/bin/zsh" | ||
} | ||
}, | ||
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace" | ||
}, | ||
"extensions": [ | ||
// go | ||
"golang.go", | ||
"mhutchie.git-graph", | ||
"ms-azuretools.vscode-docker", | ||
// Python. | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
// Errors and highlighters. | ||
"mechatroner.rainbow-csv", | ||
"redhat.vscode-yaml", | ||
"jinliming2.vscode-go-template", | ||
// markdown | ||
"yzhang.markdown-all-in-one", | ||
"davidanson.vscode-markdownlint", | ||
// proto | ||
"zxh404.vscode-proto3" | ||
] | ||
} | ||
}, | ||
"workspaceFolder": "${localWorkspaceFolder}", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind" | ||
} |
58 changes: 58 additions & 0 deletions
58
.devcontainer/docker-outside-of-docker_slim/devcontainer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"build": { | ||
"dockerfile": "../slim.Dockerfile", | ||
"context": "../..", | ||
"args": { | ||
"CLAB_VERSION": "${localEnv:CLAB_VERSION}" | ||
} | ||
}, | ||
"runArgs": [ | ||
"--network=host", | ||
"--pid=host", | ||
"--privileged" | ||
], | ||
"mounts": [ | ||
"type=bind,src=/run/docker/netns,dst=/run/docker/netns", | ||
"type=bind,src=/var/lib/docker,dst=/var/lib/docker", | ||
"type=bind,src=/lib/modules,dst=/lib/modules" | ||
], | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": { | ||
"version": "23.0.7", | ||
"dockerDashComposeVersion": "none", | ||
"installDockerComposeSwitch": "false" | ||
}, | ||
// Add sshd to support gh cli codespaces cp. | ||
"ghcr.io/devcontainers/features/sshd:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
"remoteUser": "vscode", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/bin/zsh" | ||
} | ||
}, | ||
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace" | ||
}, | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker", | ||
// Python. | ||
"ms-python.python", | ||
// Errors and highlighters. | ||
"mechatroner.rainbow-csv", | ||
"redhat.vscode-yaml", | ||
// markdown | ||
"yzhang.markdown-all-in-one", | ||
"davidanson.vscode-markdownlint" | ||
] | ||
} | ||
}, | ||
"workspaceFolder": "${localWorkspaceFolder}", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm | ||
|
||
ARG CLAB_VERSION | ||
|
||
# Add the netdevops repository | ||
RUN echo "deb [trusted=yes] https://netdevops.fury.site/apt/ /" | \ | ||
tee -a /etc/apt/sources.list.d/netdevops.list | ||
|
||
# Install necessary packages, including curl | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
direnv \ | ||
btop \ | ||
iputils-ping \ | ||
tcpdump \ | ||
iproute2 \ | ||
qemu-kvm \ | ||
dnsutils \ | ||
telnet \ | ||
curl | ||
|
||
# Install Containerlab | ||
RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${CLAB_VERSION} | ||
|
||
# Install GitHub CLI directly from the latest release | ||
RUN bash -c 'ARCH=$(uname -m | sed "s/x86_64/amd64/" | sed "s/aarch64/arm64/") && \ | ||
VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | \ | ||
grep -oP "\"tag_name\": \"\K[^\"]+") && \ | ||
CLEAN_VERSION=${VERSION#v} && \ | ||
DOWNLOAD_URL="https://github.com/cli/cli/releases/download/${VERSION}/gh_${CLEAN_VERSION}_linux_${ARCH}.tar.gz" && \ | ||
curl -L "$DOWNLOAD_URL" | tar xz -C /tmp && \ | ||
mv /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}/bin/gh /usr/local/bin/ && \ | ||
chmod +x /usr/local/bin/gh && \ | ||
rm -rf /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}' | ||
|
||
# Add empty docker config files to avoid clab warnings for root user | ||
RUN mkdir -p /root/.docker && echo "{}" > /root/.docker/config.json | ||
|
||
# Maintain SSH_AUTH_SOCK env var when using sudo | ||
RUN mkdir -p /etc/sudoers.d && echo 'Defaults env_keep += "SSH_AUTH_SOCK"' > /etc/sudoers.d/ssh_auth_sock | ||
|
||
# Switch to the vscode user provided by the base image | ||
USER vscode | ||
|
||
# Copy dclab script used to run the local containerlab build after `make build` | ||
COPY ./.devcontainer/dclab /usr/local/bin/dclab | ||
|
||
# Create SSH key for vscode user to enable passwordless SSH to devices | ||
RUN ssh-keygen -t ecdsa -b 256 -N "" -f ~/.ssh/id_ecdsa | ||
|
||
# Add empty docker config files to avoid clab warnings for vscode user | ||
RUN mkdir -p /home/vscode/.docker && echo "{}" > /home/vscode/.docker/config.json | ||
|
||
# Setup Zsh and plugins | ||
COPY ./.devcontainer/zsh/.zshrc-slim /home/vscode/.zshrc | ||
COPY ./.devcontainer/zsh/.p10k.zsh /home/vscode/.p10k.zsh | ||
COPY ./.devcontainer/zsh/install-zsh-plugins.sh /tmp/install-zsh-plugins.sh | ||
RUN bash -c "/tmp/install-zsh-plugins.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.