Skip to content

Commit c1e6277

Browse files
committed
docs: update
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent f7f4995 commit c1e6277

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,32 @@ See also [`./examples/compose-wordpress`](./examples/compose-wordpress).
5252

5353
### Debugging Kubernetes
5454

55-
To list Kubernetes containers:
55+
To list local Kubernetes containers:
5656
```console
5757
# nerdctl --namespace k8s.io ps -a
5858
```
5959

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+
6081
### Rootless mode
6182

6283
To launch rootless containerd:
@@ -136,6 +157,7 @@ Major:
136157
- Recursive read-only (RRO) bind-mount: `nerdctl run -v /mnt:/mnt:rro` (make children such as `/mnt/usb` to be read-only, too).
137158
Requires kernel >= 5.12, and crun >= 1.4 or runc >= 1.1 (PR [#3272](https://github.com/opencontainers/runc/pull/3272)).
138159
- [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`
139161

140162
Minor:
141163
- Namespacing: `nerdctl --namespace=<NS> ps` .

docs/faq.md

+25
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [How to change the CNI binary path?](#how-to-change-the-cni-binary-path)
2121
- [Kubernetes](#kubernetes)
2222
- [`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)
2324
- [containerd socket (`/run/containerd/containerd.sock`)](#containerd-socket-runcontainerdcontainerdsock)
2425
- [Does nerdctl have an equivalent of `DOCKER_HOST=ssh://<USER>@<REMOTEHOST>` ?](#does-nerdctl-have-an-equivalent-of-docker_hostsshuserremotehost-)
2526
- [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` .
243244

244245
Note: k3s users have to specify `--address` too: `sudo nerdctl --address=/run/k3s/containerd/containerd.sock --namespace=k8s.io ps -a`
245246

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+
246271
## containerd socket (`/run/containerd/containerd.sock`)
247272

248273
### Does nerdctl have an equivalent of `DOCKER_HOST=ssh://<USER>@<REMOTEHOST>` ?

0 commit comments

Comments
 (0)