code-server-dind/README.md
2025-07-13 11:53:43 -05:00

83 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🐳 code-server Dev Container with Docker-in-Docker
A developer container powered by [code-server](https://github.com/coder/code-server), with full Docker CLI support via Docker-in-Docker (DinD). Authentication and user setup is driven by environment variables via `.env` ideal for ephemeral, configurable environments.
## Features
- 💻 code-server (VS Code in the browser)
- 🐳 Docker-in-Docker (DinD)
- 🔐 Password or hashed password auth via `.env`
- 👤 Dynamic user configuration (UID, GID, password)
- ⚙️ Preinstalled: Docker, AWS CLI v2, kubectl, eksctl, Node.js, Python, Java, pre-commit, etc.
## Build
```bash
docker build -t code-server-dind .
```
## Environment Configuration (`.env`)
Create a `.env` file to define user credentials and setup:
```env
DOCKER_USER=coder
UID=1000
GID=1000
TZ=Asia/Taipei
PASSWORD=yourpassword
# Or alternatively:
# HASHED_PASSWORD=$argon2id$v=19$m=65536,t=3,p=4$...
```
> **Note:** Set only one of `PASSWORD` or `HASHED_PASSWORD`. Use `PASSWORD=none` to disable authentication.
## Run
```bash
docker run --rm -it \
--privileged \
-v code-server-home:/home/coder \
--env-file .env \
-p 8080:8080 \
code-server-dind
```
## Volume
All work is persisted in `/home/coder`, mounted via Docker volume `code-server-home`.
## Authentication Modes
- `PASSWORD=yourpass`: sets a plain password.
- `HASHED_PASSWORD=...`: sets a secure pre-hashed password.
- `PASSWORD=none`: disables authentication (not recommended for public use).
## Access
Once running, visit: [http://localhost:8080](http://localhost:8080)
Login using the credentials defined in `.env`.
## Tooling Included
- Docker CLI
- AWS CLI v2
- kubectl (`v1.32.0`)
- eksctl
- Node.js + npm
- Python 3 + venv + pipx
- Java Runtime (default-jre)
- pre-commit
- siege, jq, git, etc.
## Clean Up
```bash
docker volume rm code-server-home
```
## License
This document is distributed under the terms of the GNU General Public License v3 or later.
See the [LICENSE](LICENSE) file for more details.