From ccdde5f4424836fc8e9cc98c204510fed9612e70 Mon Sep 17 00:00:00 2001 From: hc Date: Wed, 25 Jun 2025 19:40:43 +0800 Subject: merged setup and contaienrs --- containers/docs | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 containers/docs (limited to 'containers/docs') diff --git a/containers/docs b/containers/docs new file mode 100644 index 0000000..3a0b3cc --- /dev/null +++ b/containers/docs @@ -0,0 +1,105 @@ +# Rocky SSH Container +## Setup +### SSH Keys +Place your SSH public keys in the `docker_build/ssh-keys/` directory: +```bash +cp ~/.ssh/id_ed25519.pub docker_build/ssh-keys/ +``` +The container will automatically add all `.pub` files from this directory to `/root/.ssh/authorized_keys`. + +## Building Containers +### Base Development Container +```bash +# From the dev_env directory +podman build -t rocky_dev:latest -f docker_build/Dockerfile . +``` +### GPU-Enabled Container +The GPU container builds on top of the base container using multi-stage build: +```bash +# First build the base container (from dev_env directory) +podman build -t rocky_dev:latest -f docker_build/Dockerfile . +# Then build the GPU version +podman build -t rocky_dev_gpu:latest -f docker_build/Dockerfile.gpu . +``` + +## GPU Support +The GPU-enabled container includes: +- NVIDIA Container Toolkit for GPU access +- GPU test script at `/usr/local/bin/gpu-test.sh` +- Environment variables configured for NVIDIA GPU visibility +- Workspace directory at `/workspace` for GPU workloads + +### Running with GPU Support +```bash +# Run GPU-enabled container +podman run -it --device nvidia.com/gpu=all rocky_dev_gpu:latest +# Test GPU inside container +gpu-test.sh +nvidia-smi +``` + +## Podman +```bash +python3 podman_launch_devenv.py +python3 podman_launch_devenv.py run +python3 podman_launch_devenv.py run -p 2222 +python3 podman_launch_devenv.py list +python3 podman_launch_devenv.py cleanup +``` + +## Kubernetes +```bash +kubectl apply -f rocky-ssh-deployment.yaml +kubectl get pods -l app=rocky-dev -o wide +kubectl get svc rocky-dev-svc +kubectl delete pod rocky-dev-0 +kubectl scale statefulset rocky-dev --replicas=10 +kubectl delete -f rocky-ssh-deployment.yaml +``` +### Kubernetes GPU Deployment +```bash +kubectl apply -f rocky-ssh-gpu-deployment.yaml +kubectl get pods -l app=rocky-dev-gpu -o wide +kubectl describe pod rocky-dev-gpu-0 | grep nvidia +kubectl exec -it rocky-dev-gpu-0 -- nvidia-smi +kubectl scale statefulset rocky-dev-gpu --replicas=4 +kubectl delete -f rocky-ssh-gpu-deployment.yaml +``` + +## Local Registry +```bash +podman run -d -p 5000:5000 --name registry registry:2 +podman tag localhost/rocky_dev:latest localhost:5000/rocky_dev:latest +podman push localhost:5000/rocky_dev:latest --tls-verify=false +``` + +## Access +```bash +# Direct shell +kubectl exec -it rocky-dev-0 -- /bin/bash +# SSH with agent forwarding (2 terminals) +kubectl port-forward rocky-dev-0 2222:22 +ssh-agent bash -c 'ssh-add ~/macm4-resident && ssh -A -p 2222 root@localhost' +# External +kubectl port-forward --address 0.0.0.0 rocky-dev-0 9999:22 +``` + +## Features +### Development Tools +- C/C++ development: gcc, gcc-c++, make, cmake +- Python 3 with pip and development headers +- Rust toolchain with cargo tools (cargo-edit, bacon, evcxr_jupyter) +- Node.js v22 via nvm +- Claude Code CLI tool + +### System Utilities +- SSH server with key-based authentication +- tmux, vim, nano editors +- htop, bmon for system monitoring +- git, wget, tree, bat +- Network tools: nc, net-tools, wireguard-tools + +### GPU Computing (GPU version only) +- NVIDIA GPU support via container toolkit +- GPU test utilities +- Dedicated /workspace directory for ML/GPU workloads -- cgit v1.2.3-70-g09d2