Files
ubuntu/README.md

88 lines
2.6 KiB
Markdown

# Ubuntu Dev Environment
Multi-arch (`amd64`/`arm64`) Ubuntu Docker images with pre-installed networking, development, and debugging tools. Built for use as a general-purpose dev environment.
## Available Images
| Version | Gitea | GitHub |
|---------|-------|--------|
| 24.04 (latest) | `gitea.ahkhan.me/docker/ubuntu-24.04` | `ghcr.io/ahkhan03/ubuntu-24.04` |
| 22.04 | `gitea.ahkhan.me/docker/ubuntu-22.04` | `ghcr.io/ahkhan03/ubuntu-22.04` |
| 20.04 | `gitea.ahkhan.me/docker/ubuntu-20.04` | `ghcr.io/ahkhan03/ubuntu-20.04` |
The `ubuntu:latest` tag points to Ubuntu 24.04.
## Environment Variables
### SSH
| Variable | Default | Description |
|----------|---------|-------------|
| `ENABLE_SSH` | `true` | Start the SSH server on port 22. Set to `false` to disable. |
### Startup / Shutdown Commands
| Variable | Default | Description |
|----------|---------|-------------|
| `COMMAND_INIT` | — | Command to run on container startup. The last init command runs in the background to allow signal handling. |
| `COMMAND_INIT01`..`COMMAND_INIT99` | — | Additional numbered init commands, executed in order after `COMMAND_INIT`. |
| `COMMAND_EXIT` | — | Command to run on container shutdown (before processes are terminated). |
| `COMMAND_EXIT01`..`COMMAND_EXIT99` | — | Additional numbered exit commands, executed in order after `COMMAND_EXIT`. |
### Logging
| Variable | Default | Description |
|----------|---------|-------------|
| `LOG_FILE` | `/dev/null` | Path to a log file to tail. When set, the container's stdout will stream this file. |
### Mirrors (China)
| Variable | Default | Description |
|----------|---------|-------------|
| `USE_CHINA_MIRRORS` | `false` | Switch apt, pip, and npm to Aliyun mirrors on startup. |
### Package Updates
| Variable | Default | Description |
|----------|---------|-------------|
| `UPDATE_APT` | `false` | Run `apt update` on startup (with network check). |
## Usage Examples
Basic:
```bash
docker run -d ghcr.io/ahkhan03/ubuntu-24.04
```
With a startup command and SSH:
```bash
docker run -d -p 2222:22 \
-e COMMAND_INIT="echo 'hello from init'" \
ghcr.io/ahkhan03/ubuntu-24.04
```
Multiple init/exit commands:
```bash
docker run -d \
-e COMMAND_INIT01="echo 'first'" \
-e COMMAND_INIT02="python3 -m http.server 8080" \
-e COMMAND_EXIT01="echo 'shutting down'" \
ghcr.io/ahkhan03/ubuntu-24.04
```
Without SSH, with China mirrors:
```bash
docker run -d \
-e ENABLE_SSH=false \
-e USE_CHINA_MIRRORS=true \
ghcr.io/ahkhan03/ubuntu-24.04
```
## Building
```bash
./build.sh
```
See `./build.sh --help` for configuration options.