Installing containerd
Can follow the docs here.
Components installed:
- containerd itself (a "runtime")
- cni plugin
- runc (the actual) runtime
"Runtime" container
"Build" dockerfile, eg.
1. FROM base image
2. RUN Download service archive -- build
3. ENTRYPOINT from the archive -- runtime
Source link
Install buildkit
Errors encountered
d
is an alias for nerdctl
or docker
if you want.
Exec failed
When using redis:alpine
image as redis
container,
nerdctl container exec redis bash
FATA[0000] OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH
If the binary is not installed inside the container.
Creating a executable script inside container, but cannot be run using docker
I have a,
echo "Hello, World!"
That I have created inside a redis
containre with redis:alpine
image, in /data/hello.sh
.
When I tried to execute it, it fails:
d container exec redis /data/hello.sh
exec /data/hello.sh: exec format error
FATA[0000] exec failed with exit code 255
I've solved it by adding
#!/bin/sh
echo "Hello, World!"
according to this link.
d container exec redis /data/hello.sh
Hello World!
There seems to be something hidden variable in the container exec
command that I can investage further.
Pipeline implementation
- Dicode nya sendiri ditambahin build script yang respect gooenv, kemudian output directory nya respect goos & architecture
- jadi entah dia mau buildnya pakai docker or kalau golang bisa langsung, bebas. sekali lagi di build artifactnya akan muncul prefix os/architecturenya juga.
-
Kemudian scp build artifact seperti biasa ke tmp folder dari instance / unified repository mungkin: /tmp/artefact/<service-name>/version-os-arch.tar.gz
-
Kemudian ada Docker build script di suatu folder, yang tugasnya ambil image base, setup2, kemudian copy artifact, kemudian commit artifact tersebut mungkin biar mudah: /tmp/dockerfile/<service-name>/Dockerfile
-
Apabila image nya sudah jadi akan otomatis muncul di docker.
-
Kemudian pakai compose
Ramblings
- Zero downtime apabila aplikasi upgrade.
- di golang nya handle Shutdown than sigint
- kemudian di "depan" ada yang "jagain" TCP/HTTP connection supaya masih bisa terima VALID connection (meskipun nambah latensi)
Mungkin bisa pakai shell script semacam...
docker exec service update.sh
Installing k3s (a Kubernetes implementation)
Not suitable for me and my usecase, it's not lightweight. It causes my small VM to lag.
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-backend none --container-runtime-endpoint /run/containerd/containerd.sock" sh -s -
- We use
--flannel-backend none
because we already use container network plugin when installingcontainerd
separately. - We use
--container-runtime-endpoint
because we already installedcontainerd
, and that's its existing socket address.
I'm more suitable with containerd & containerd compose.