--- display_name: Docker Workspaces with GPU & DooD description: Provision Docker-based Coder workspaces with selectable GPU support, Docker-out-of-Docker, Go, Bun, and Opencode. icon: /icon/docker.svg maintainer_github: sirblob verified: false tags: [docker, container, gpu, golang, bun, sdkman, opencode, ollama] --- # Feature-Rich Docker Workspaces Provision powerful Docker containers as [Coder workspaces](https://coder.com/docs/workspaces) with this template. It features selectable GPU passthrough, Docker-out-of-Docker (DooD), and pre-installs essential development tools via a custom Dockerfile. ## Prerequisites ### Infrastructure The host you run Coder on must have a running Docker socket, the NVIDIA container runtime installed, and the `coder` user added to the Docker group: ```sh sudo adduser coder docker sudo systemctl restart coder sudo -u coder docker ps ``` ## Features & Architecture This template provisions the following resources and features: - **Base Image**: Custom image built from `codercom/enterprise-base:ubuntu`. - **Selectable GPU Support**: A `GPU Assignment` parameter chooses which GPU(s) to attach. The default is **GPU 0**, because GPU 1 is shared with the `ollama` and `immich` stacks; pick `GPU 1 only` or `Both GPUs` when you need them. - **Docker-out-of-Docker (DooD)**: Mounts the host's `/var/run/docker.sock` so you can build and run containers from inside your workspace. - **Ollama Integration**: `OLLAMA_HOST` is preset to `http://host.docker.internal:11434`, so tools in the workspace talk to the homelab Ollama service out of the box. - **Pre-baked Tools**: The custom Docker image comes pre-installed with: - System package updates - Docker CLI - Bun - Go (pinned version, installed from the official tarball) - SDKMAN! & Maven - Opencode - `jq`, `build-essential` - **Persistent Storage**: Uses a persistent host directory mapped to `/home/coder` so files survive workspace restarts. - **Rich Telemetry**: Displays CPU, RAM, Disk, Load Average, and GPU utilization directly in the Coder UI. - **IDE Support**: Native integration with code-server (Browser VS Code) and JetBrains IDEs. ## Using the homelab services ### Ollama `OLLAMA_HOST` is already exported in the workspace. Verify with: ```sh curl "$OLLAMA_HOST/api/tags" ``` ### Gitea container registry With DooD enabled you can build and push images straight to the Gitea registry from inside a workspace: ```sh docker login git.sirblob.co -u -p docker build -t git.sirblob.co//: . docker push git.sirblob.co//: ``` See `projects.md` in the homelab repo for the full registry workflow. > **Note** > While your `/home/coder` directory is persistent, the container's root filesystem is ephemeral. This template builds a custom Docker image to pre-bake tools (Go, Bun, SDKMAN!, Opencode, etc.), ensuring your workspace starts instantly while keeping the tools available.