mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-24 19:28:09 +00:00
Add documentation for system containerd
Add an example script showing how you can run an nginx container. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
b2098526c4
commit
449e0c7d7e
30
docs/containerd.md
Normal file
30
docs/containerd.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
## Using the system containerd
|
||||||
|
|
||||||
|
Here is a simple example script that will run a container using the system containerd.
|
||||||
|
|
||||||
|
You should run it from `/var` as the root filesystem is in RAM, and will use up memory.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NAME=nginx
|
||||||
|
VERSION=latest
|
||||||
|
|
||||||
|
docker pull ${NAME}:${VERSION}
|
||||||
|
CONTAINER=$(docker create --net=host --security-opt apparmor=unconfined --oom-score-adj=-500 -v /var/log/nginx:/var/log/nginx -v /var/cache/nginx:/var/cache/nginx -v /var/run:/var/run ${NAME}:${VERSION})
|
||||||
|
docker run -v ${PWD}:/conf -v /var/run/docker.sock:/var/run/docker.sock --rm jess/riddler -f -bundle /conf ${CONTAINER}
|
||||||
|
rm -rf rootfs && mkdir rootfs
|
||||||
|
docker export ${CONTAINER} | tar -C rootfs -xf -
|
||||||
|
docker rm ${CONTAINER}
|
||||||
|
|
||||||
|
mkdir -p /var/log/nginx /var/cache/nginx
|
||||||
|
|
||||||
|
containerd-ctr containers start ${NAME} .
|
||||||
|
containerd-ctr containers
|
||||||
|
```
|
||||||
|
|
||||||
|
For debugging it helps to run `containerd-ctr containers start --attach ${NAME} .` It may
|
||||||
|
well turn out that you need to create directories that are empty volumes in docker.
|
||||||
|
|
||||||
|
For production, you will want to create the `config.json` offline and bundle it in with your
|
||||||
|
intii script, but you can create the rootfs online.
|
Loading…
Reference in New Issue
Block a user