|
2 | 2 |
|
3 | 3 | There are a few ways to run Docker within container-based Coder workspaces.
|
4 | 4 |
|
5 |
| -| Method | Description | Limitations | |
6 |
| -| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
7 |
| -| [Sysbox container runtime](#sysbox-container-runtime) | Install sysbox on your Kubernetes nodes for secure docker-in-docker and systemd-in-docker. Works with GKE, EKS, AKS. | Requires [compatible nodes](https://github.com/nestybox/sysbox#host-requirements). Max of 16 sysbox pods per node. [See all](https://github.com/nestybox/sysbox/blob/master/docs/user-guide/limitations.md) | |
8 |
| -| [Privileged docker sidecar](#privileged-sidecar-container) | Run docker as a privilged sidecar container. | Requires a privileged container. Workspaces can break out to root on the host machine. | |
| 5 | +| Method | Description | Limitations | |
| 6 | +| ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 7 | +| [Sysbox container runtime](#sysbox-container-runtime) | Install the sysbox runtime on your Kubernetes nodes for secure docker-in-docker and systemd-in-docker. Works with GKE, EKS, AKS. | Requires [compatible nodes](https://github.com/nestybox/sysbox#host-requirements). Max of 16 sysbox pods per node. [See all](https://github.com/nestybox/sysbox/blob/master/docs/user-guide/limitations.md) | |
| 8 | +| [Rootless Podman](https://github.com/bpmct/coder-templates/tree/main/rootless-podman) | Run podman inside Coder workspaces. Does not require a custom runtime or privileged containers. Works with GKE, EKS, AKS, RKE, OpenShift | Requires smarter-device-manager for FUSE mounts. [See all](https://github.com/containers/podman/blob/main/rootless.md#shortcomings-of-rootless-podman) | |
| 9 | +| [Privileged docker sidecar](#privileged-sidecar-container) | Run docker as a privileged sidecar container. | Requires a privileged container. Workspaces can break out to root on the host machine. | |
9 | 10 |
|
10 | 11 | ## Sysbox container runtime
|
11 | 12 |
|
@@ -109,6 +110,75 @@ resource "kubernetes_pod" "dev" {
|
109 | 110 |
|
110 | 111 | > Sysbox CE (Community Edition) supports a maximum of 16 pods (workspaces) per node on Kubernetes. See the [Sysbox documentation](https://github.com/nestybox/sysbox/blob/master/docs/user-guide/install-k8s.md#limitations) for more details.
|
111 | 112 |
|
| 113 | +## Rootless podman |
| 114 | + |
| 115 | +[Podman](https://docs.podman.io/en/latest/) is Docker alternative that is compatible with OCI containers specification. which can run rootless inside Kubernetes pods. No custom RuntimeClass is required. |
| 116 | + |
| 117 | +Prior to completing the steps below, please review the following Podman documentation: |
| 118 | + |
| 119 | +- [Basic setup and use of Podman in a rootless environment](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md) |
| 120 | + |
| 121 | +- [Shortcomings of Rootless Podman](https://github.com/containers/podman/blob/main/rootless.md#shortcomings-of-rootless-podman) |
| 122 | + |
| 123 | +1. Enable [smart-device-manager](https://gitlab.com/arm-research/smarter/smarter-device-manager#enabling-access) to securely expose a FUSE devices to pods. |
| 124 | + |
| 125 | + ```sh |
| 126 | + cat <<EOF | kubectl create -f - |
| 127 | + apiVersion: apps/v1 |
| 128 | + kind: DaemonSet |
| 129 | + metadata: |
| 130 | + name: fuse-device-plugin-daemonset |
| 131 | + namespace: kube-system |
| 132 | + spec: |
| 133 | + selector: |
| 134 | + matchLabels: |
| 135 | + name: fuse-device-plugin-ds |
| 136 | + template: |
| 137 | + metadata: |
| 138 | + labels: |
| 139 | + name: fuse-device-plugin-ds |
| 140 | + spec: |
| 141 | + hostNetwork: true |
| 142 | + containers: |
| 143 | + - image: soolaugust/fuse-device-plugin:v1.0 |
| 144 | + name: fuse-device-plugin-ctr |
| 145 | + securityContext: |
| 146 | + allowPrivilegeEscalation: false |
| 147 | + capabilities: |
| 148 | + drop: ["ALL"] |
| 149 | + volumeMounts: |
| 150 | + - name: device-plugin |
| 151 | + mountPath: /var/lib/kubelet/device-plugins |
| 152 | + volumes: |
| 153 | + - name: device-plugin |
| 154 | + hostPath: |
| 155 | + path: /var/lib/kubelet/device-plugins |
| 156 | + imagePullSecrets: |
| 157 | + - name: registry-secret |
| 158 | + EOF |
| 159 | + ``` |
| 160 | +
|
| 161 | +2. Be sure to label your nodes to enable smarter-device-manager: |
| 162 | +
|
| 163 | + ```sh |
| 164 | + kubectl get nodes |
| 165 | + kubectl label nodes --all smarter-device-manager=enabled |
| 166 | + ``` |
| 167 | +
|
| 168 | + > ⚠️ **Warning**: If you are using a managed Kubernetes distribution (e.g. AKS, EKS, GKE), be sure to set node labels via your cloud provider. Otherwise, your nodes may drop the labels and break podman functionality. |
| 169 | +
|
| 170 | +3. For systems running SELinux (typically Fedora-, CentOS-, and Red Hat-based systems), you may need to disable SELinux or set it to permissive mode. |
| 171 | +
|
| 172 | +4. Import our [kubernetes-podman](https://github.com/coder/coder/tree/main/examples/templates/kubernetes-podman) example template, or make your own. |
| 173 | +
|
| 174 | + ```sh |
| 175 | + echo "kubernetes-podman" | coder templates init |
| 176 | + cd ./kubernetes-podman |
| 177 | + coder templates create |
| 178 | + ``` |
| 179 | +
|
| 180 | + > For more information around the requirements of rootless podman pods, see: [How to run Podman inside of Kubernetes](https://www.redhat.com/sysadmin/podman-inside-kubernetes) |
| 181 | +
|
112 | 182 | ## Privileged sidecar container
|
113 | 183 |
|
114 | 184 | A [privileged container](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) can be added to your templates to add docker support. This may come in handy if your nodes cannot run Sysbox.
|
|
0 commit comments