A detailed reference for the workflow inside the container once it's running. The README has the compact version; this doc is the full tour.
- Accessing the IDE in the browser
- Connecting from local VS Code
- Connecting from Cursor, Windsurf, and other VS Code forks
- The integrated terminal
- Installing extensions
- Working with your code
- Git and SSH auth
- Running ML workloads — quick verification
- Installing project-specific dependencies
- Jupyter and notebooks
- Persistence and backups
- Updating the image
- Troubleshooting
Navigate to your deployed URL (or http://<host>:8080 for plain Docker) and enter PASSWORD. You're now in a full VS Code — extensions install, the integrated terminal is a real bash shell inside the container, keyboard shortcuts work.
One gotcha — browser shortcut collisions. In a browser tab:
- Ctrl+W closes the tab.
- Ctrl+N opens a new browser window.
- Ctrl+T opens a new browser tab.
Two fixes, either works:
- Install as a PWA. Chrome / Edge address bar → the Install icon → Install cuda-code-server. Opens in a standalone window with no browser keybindings stealing yours.
- Rebind in code-server. Ctrl+Shift+P → Preferences: Open Keyboard Shortcuts → reassign the conflicting bindings.
The browser IDE is the fastest path for casual work — install it as a PWA and it behaves like a native app. For deeper workflows (Microsoft-exclusive extensions like Pylance or Copilot, SSH-agent forwarding, native window chrome), use Remote-SSH.
The image ships with openssh-server baked in, off by default. Enable it with three env vars on your deployment:
environment:
ENABLE_SSHD: "true"
SSH_PORT: "2222" # optional, 2222 is the default
SSH_AUTHORIZED_KEYS: "ssh-ed25519 AAAAC3Nz... you@laptop"Then expose port 2222 — the mechanism depends on your deployment target (Dokploy: direct host port or Traefik TCP entrypoint; Kubernetes: Service of type NodePort / LoadBalancer; plain Docker: -p 2222:2222).
Connect from local VS Code:
-
Install the Remote - SSH extension.
-
Add to
~/.ssh/config:Host cuda-code-server HostName your-deployment.example.com Port 2222 User coder IdentityFile ~/.ssh/id_ed25519 -
F1 → Remote-SSH: Connect to Host... →
cuda-code-server. -
File → Open Folder →
/home/coder/project.
Full walk-through (Cursor, Windsurf, plain ssh, Dokploy TCP exposure, ~/.ssh/config template, key rotation, troubleshooting): docs/remote-ssh.md.
Same as VS Code — Cursor and Windsurf both ship compatible Remote-SSH extensions. Same ~/.ssh/config entry, same connect flow. One caveat: Cursor's marketplace is Open VSX (same as code-server), so Microsoft-exclusive extensions aren't available in Cursor even over Remote-SSH. Free equivalents (Pyright, clangd, Continue) work fine.
Per-fork specifics in docs/remote-ssh.md.
Open with Ctrl+` (backtick). It's a real interactive bash shell, running as the coder user inside the container.
- Python venv auto-activates.
/home/coder/.venvis both onPATH(baked in via DockerfileENV) andsourced at shell start (via.bashrc).pythonandpipare the venv's. Deactivate withdeactivate. sudois passwordless. Install system packages withsudo apt install <pkg>— but know that the root filesystem is ephemeral; on container recreation those packages are gone. For persistent system changes, use a child Dockerfile (§12 below).dockerCLI works against the host daemon if you mounted/var/run/docker.sock. Test withdocker ps. If it says permission denied, the entrypoint's GID fixup didn't take hold — open a fresh terminal, or see §13.ghandclaudeare on PATH.gh auth loginfor GitHub;claudeto launch the Claude Code CLI.
Extensions install from Open VSX, not the Microsoft marketplace. code-server uses Open VSX for licensing reasons — Microsoft explicitly disallows non-Microsoft VS Code distributions from using their marketplace.
Most popular extensions are on Open VSX. The UX is identical: Ctrl+Shift+X, search, install.
Microsoft-exclusive extensions and their Open VSX substitutes:
| Microsoft-only | Free alternative on Open VSX |
|---|---|
| Pylance | Pyright (same engine, MIT-licensed) |
| C/C++ IntelliSense | clangd |
| Remote-Containers | You're already running in a container — the Dev Containers workflow isn't needed here |
| GitHub Copilot (Microsoft build) | Continue, Cline — both capable AI coding assistants |
Sideloading a VSIX (for extensions you have as a .vsix file):
# Downloaded .vsix from a GitHub Release or the extension author's site:
curl -LO 'https://example.com/my-extension.vsix'
code-server --install-extension ./my-extension.vsix
# Then reload the IDE:
# Ctrl+Shift+P → "Developer: Reload Window"Persistence. Installed extensions live under /home/coder/.local/share/code-server/extensions. They persist across container restarts only if /home/coder is on a volume (it should be — see §11).
Three patterns, in order of preference:
cd ~/project
git clone git@github.com:you/your-repo.git
cd your-repoFirst-time: you'll need SSH or HTTPS credentials — see §7.
Good if you want code to live on the host filesystem so it survives container deletion independent of the named project volume. In docker-compose.yml:
volumes:
- /path/on/host:/home/coder/projectWatch for file ownership: if the host user's UID ≠ 1000, bind-mounted files may appear as nobody:nogroup inside the container. Either align the host user to UID 1000, or add a chown step in a child Dockerfile.
Drag files from your desktop into the VS Code file explorer in the browser. Fine for one-off uploads; not great for Git workflows. Uses the browser's File API — no need for scp or rsync.
Inside the container, git works but has no credentials out of the box. Two options:
# Generate a key:
ssh-keygen -t ed25519 -C "coder@cuda-code-server" -f ~/.ssh/id_ed25519 -N ''
# Print the public key so you can paste it into GitHub:
cat ~/.ssh/id_ed25519.pubGo to GitHub → Settings → SSH and GPG keys → New SSH key, paste, save.
Test:
ssh -T git@github.com
# should say: "Hi <you>! You've successfully authenticated..."~/.ssh persists on the home volume; the key survives container recreation.
gh auth login
# pick "GitHub.com", HTTPS, and "Login with a web browser"gh stores credentials in ~/.config/gh (also on the home volume). After this, gh repo clone <owner>/<repo> and plain git clone https://github.com/... both work.
If you connect from local VS Code via Remote-SSH, the host's ssh-agent is forwarded — git inside the container uses your laptop's keys. Not available in pure browser mode.
In the terminal:
# GPU visible?
nvidia-smi
# PyTorch sees CUDA?
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.device_count())"
# Actually run on the GPU:
python -c "import torch; x = torch.randn(1000, 1000).cuda(); print((x @ x).sum().item())"A short end-to-end smoke test — MNIST-shaped MLP on GPU, three training epochs:
import torch, torch.nn as nn, torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset
device = torch.device("cuda")
# Fake MNIST-shaped data so we don't need torchvision datasets on disk.
X = torch.randn(1024, 784, device=device)
y = torch.randint(0, 10, (1024,), device=device)
loader = DataLoader(TensorDataset(X, y), batch_size=64, shuffle=True)
model = nn.Sequential(nn.Linear(784, 128), nn.ReLU(), nn.Linear(128, 10)).to(device)
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
for epoch in range(3):
for xb, yb in loader:
opt.zero_grad()
loss = F.cross_entropy(model(xb), yb)
loss.backward()
opt.step()
print(f"epoch {epoch} loss={loss.item():.4f}")
print("done — ran on", next(model.parameters()).device)If this finishes and prints cuda:0 for the device, the full stack is healthy.
The bundled venv (/home/coder/.venv) has the common ML libs (torch, numpy, pandas, matplotlib, ipykernel). For real project work, create a per-project venv so your dependency graph is reproducible:
cd ~/project/your-repo
uv venv # creates .venv here, fast
source .venv/bin/activate
uv pip install -r requirements.txtuv is fast at this — cold uv pip install of a typical requirements.txt is 5–20× faster than pip.
Other toolchains (Poetry, Pipenv, plain pip, conda) work too — the base tooling is all there. Pick whatever your project already uses.
For installing torch into a project venv, remember to pass the CUDA-matched index:
uv pip install --index-url https://download.pytorch.org/whl/cu126 torchThe recommended path: VS Code's built-in Jupyter support. Open a .ipynb file in the IDE. VS Code auto-discovers the container's Python kernels — select the bundled one at /home/coder/.venv/bin/python (shown as .venv in the kernel picker) or any project-specific venv you've created. No separate server, no port forwarding, full notebook UX inside the IDE.
If you want jupyter lab specifically (e.g., because you have existing JupyterLab workflows):
uv pip install jupyterlab
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token=''Then expose port 8888 in your deployment (add "8888:8888" to ports: in compose, or add a Service + Ingress in Kubernetes). Remember: --NotebookApp.token='' means no auth, so gate it behind your reverse proxy's auth layer or restrict it to localhost.
Anything under /home/coder, if the directory is a named or bind-mounted volume. Specifically:
/home/coder/.local/share/code-server/— installed extensions, keybindings, user settings./home/coder/.config/— app configs (ghauth, git config, etc.)./home/coder/.ssh/— SSH keys (sogit clone git@github.com:...keeps working)./home/coder/.bash_history,/home/coder/.venv/— shell history and the bundled venv./home/coder/project/— your code (typically a separate volume).
Everything else:
/tmp,/var/tmp,/root.- System packages installed via
sudo apt install …at runtime. - Modified system configs (
/etc/*). - Internal
code-serverstate outside/home/coder.
For persistent system-level changes, extend via a child Dockerfile:
FROM ghcr.io/harshpatel333/cuda-code-server:12.6-py312
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg libgl1 \
&& rm -rf /var/lib/apt/lists/*
USER coderBuild locally or push to your own registry, then use that image.
Ad-hoc tarball of a named volume (works for Docker Compose / plain docker run):
VOLUME=cuda-code-server-project
docker run --rm \
-v "${VOLUME}:/data" \
-v "$(pwd):/backup" \
alpine \
tar czf "/backup/${VOLUME}-$(date +%F).tar.gz" -C /data .Restore into an empty volume:
docker volume create cuda-code-server-project
docker run --rm \
-v cuda-code-server-project:/data \
-v "$(pwd):/backup" \
alpine \
tar xzf /backup/cuda-code-server-project-YYYY-MM-DD.tar.gz -C /dataFor Dokploy, enable host-level volume snapshots via the Dokploy Volumes tab. For Kubernetes, use a CSI driver that supports snapshots (Longhorn, Rook-Ceph, cloud-provider CSIs).
docker pull ghcr.io/harshpatel333/cuda-code-server:12.6-py312
docker stop cuda-code-server && docker rm cuda-code-server
docker run -d \
--name cuda-code-server \
--gpus all \
-e PASSWORD="$PASSWORD" \
-p 8080:8080 \
-v cuda-code-server-home:/home/coder \
-v cuda-code-server-project:/home/coder/project \
ghcr.io/harshpatel333/cuda-code-server:12.6-py312docker compose pull
docker compose up -dChange the image: tag in the compose file. Click Redeploy.
Edit the tag in the Deployment manifest and kubectl apply -f deployment.yaml. The strategy: Recreate in the manifest ensures the old pod releases the ReadWriteOnce PVCs before the new pod claims them.
Persistent volumes (home, project) survive every update. Breaking changes between versions are called out in CHANGELOG.md.
The NVIDIA Container Toolkit isn't installed or configured on the host. Install and restart Docker:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \
sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart dockerCanonical reference: NVIDIA docs.
The entrypoint normally aligns the in-container docker group GID with the host socket's GID at startup. If it didn't work (e.g., you overrode USER in compose, or the socket wasn't mounted at first boot), fix manually:
sudo groupmod -g "$(stat -c '%g' /var/run/docker.sock)" docker
newgrp docker # or: open a fresh terminalThree options, in order of effort:
- Use a free alternative from the table in §5.
- Sideload a VSIX: download the
.vsix(from the extension's GitHub Releases or the author's site), thencode-server --install-extension ./*.vsixin the terminal. - Fall back to Remote-SSH from local VS Code against a version of the container with
sshdexposed — desktop VS Code can use the Microsoft marketplace.
You're running a mismatched CUDA-and-torch pair. The image pairs:
- CUDA 12.6.1 with
cu126PyTorch wheels. - CUDA 12.4.1 with
cu124PyTorch wheels.
If you installed torch yourself and bypassed the correct index, reinstall:
uv pip install --index-url https://download.pytorch.org/whl/cu126 --force-reinstall torchOpen a new browser window in incognito / private mode, or clear the cookies for the domain. The old session cookie is no longer valid.
Individual matrix cells take 15–30 min cold, 5–10 min warm. If CI is timing out, it's usually the PyTorch wheel download (~2 GB). Check network egress from the runner, and verify cache-from: type=gha is producing hits on the second build — the first "warm" build will still be slow, but the second should hit cache and finish quickly.
The bundled venv creation runs at image-build time, not container start — so "slow on first run" usually means either (a) the image pull is still in progress (6 GB — several minutes on slow links), or (b) the GPU is pinned by another container. Check:
nvidia-smi # is the GPU occupied?
docker stats # CPU / memory saturated?
docker logs <container> # crash-looping?If none of the above covers your issue: open a bug report using the template at .github/ISSUE_TEMPLATE/bug_report.yml. Include the image tag, deployment target, container logs, and host environment.