File tree 2 files changed +48
-1
lines changed
2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,32 @@ See also [`./examples/compose-wordpress`](./examples/compose-wordpress).
52
52
53
53
### Debugging Kubernetes
54
54
55
- To list Kubernetes containers:
55
+ To list local Kubernetes containers:
56
56
``` console
57
57
# nerdctl --namespace k8s.io ps -a
58
58
```
59
59
60
+ To build an image for local Kubernetes without using registry:
61
+ ``` console
62
+ # nerdctl --namespace k8s.io build -t foo /some-dockerfile-directory
63
+ # kubectl apply -f - << EOF
64
+ apiVersion: v1
65
+ kind: Pod
66
+ metadata:
67
+ name: foo
68
+ spec:
69
+ containers:
70
+ - name: foo
71
+ image: foo
72
+ imagePullPolicy: Never
73
+ EOF
74
+ ```
75
+
76
+ To load an image archive (` docker save ` format or OCI format) into local Kubernetes:
77
+ ``` console
78
+ # nerdctl --namespace k8s.io load < /path/to/image.tar
79
+ ```
80
+
60
81
### Rootless mode
61
82
62
83
To launch rootless containerd:
@@ -136,6 +157,7 @@ Major:
136
157
- Recursive read-only (RRO) bind-mount: ` nerdctl run -v /mnt:/mnt:rro ` (make children such as ` /mnt/usb ` to be read-only, too).
137
158
Requires kernel >= 5.12, and crun >= 1.4 or runc >= 1.1 (PR [ #3272 ] ( https://github.com/opencontainers/runc/pull/3272 ) ).
138
159
- [ Cosign integration] ( ./docs/cosign.md ) : ` nerdctl pull --verify=cosign ` and ` nerdctl push --sign=cosign `
160
+ - [ Accelerated rootless containers using bypass4netns] ( ./docs/rootless.md ) : ` nerdctl run --label nerdctl/bypass4netns=true `
139
161
140
162
Minor:
141
163
- Namespacing: ` nerdctl --namespace=<NS> ps ` .
Original file line number Diff line number Diff line change 20
20
- [ How to change the CNI binary path?] ( #how-to-change-the-cni-binary-path )
21
21
- [ Kubernetes] ( #kubernetes )
22
22
- [ ` nerdctl ps -a ` does not show Kubernetes containers] ( #nerdctl-ps--a-does-not-show-kubernetes-containers )
23
+ - [ How to build an image for Kubernetes?] ( #how-to-build-an-image-for-kubernetes )
23
24
- [ containerd socket (` /run/containerd/containerd.sock ` )] ( #containerd-socket-runcontainerdcontainerdsock )
24
25
- [ Does nerdctl have an equivalent of ` DOCKER_HOST=ssh://<USER>@<REMOTEHOST> ` ?] ( #does-nerdctl-have-an-equivalent-of-docker_hostsshuserremotehost- )
25
26
- [ Does nerdctl have an equivalent of ` sudo usermod -aG docker <USER> ` ?] ( #does-nerdctl-have-an-equivalent-of-sudo-usermod--ag-docker-user- )
@@ -243,6 +244,30 @@ Try `sudo nerdctl --namespace=k8s.io ps -a` .
243
244
244
245
Note : k3s users have to specify `--address` too: `sudo nerdctl --address=/run/k3s/containerd/containerd.sock --namespace=k8s.io ps -a`
245
246
247
+ # ## How to build an image for Kubernetes?
248
+
249
+ For a multi-node cluster :
250
+ ` ` ` console
251
+ $ nerdctl build -t example.com/foo /some-dockerfile-directory
252
+ $ nerdctl push example.com/foo
253
+ ` ` `
254
+
255
+ For a single-node cluster w/o registry :
256
+ ` ` ` console
257
+ # nerdctl --namespace k8s.io build -t foo /some-dockerfile-directory
258
+ # kubectl apply -f - <<EOF
259
+ apiVersion: v1
260
+ kind: Pod
261
+ metadata:
262
+ name: foo
263
+ spec:
264
+ containers:
265
+ - name: foo
266
+ image: foo
267
+ imagePullPolicy: Never
268
+ EOF
269
+ ` ` `
270
+
246
271
# # containerd socket (`/run/containerd/containerd.sock`)
247
272
248
273
# ## Does nerdctl have an equivalent of `DOCKER_HOST=ssh://<USER>@<REMOTEHOST>` ?
You can’t perform that action at this time.
0 commit comments