Kubernetes with nerdctl
Kubernetes in version 1.24 provides a big change by removing dockershim
it means that with some exceptions like
cri-dockerd you won’t see docker on a Kubernetes node. It’s a disadvantage
for me to debug stuff directly on a Kubernetes node with the familiar docker
CLI command. Of course, we have
something similar but working with containerd
it’s called
ctr, but to be honest, in some concepts it’s a
different beast ie. ctr task exec
, but what does it mean
task?
Fortunately, there is something more familiar to what I know before it’s called
nerdctl, it has almost the same ui/ux to docker.
Let’s compare all of them with the exec
subcommand:
# ctr task exec --help
NAME:
ctr tasks exec - execute additional processes in an existing container
USAGE:
ctr tasks exec [command options] [flags] CONTAINER CMD [ARG...]
OPTIONS:
--cwd value working directory of the new process
--tty, -t allocate a TTY for the container
--detach, -d detach from the task after it has started execution
--exec-id value exec specific id for the process
--fifo-dir value directory used for storing IO FIFOs
--log-uri value log uri for custom shim logging
--user value user id or name
# docker exec --help
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Run a command in a running container
Options:
-d, --detach Detached mode: run command in the background
--detach-keys string Override the key sequence for detaching a container
-e, --env list Set environment variables
--env-file list Read in a file of environment variables
-i, --interactive Keep STDIN open even if not attached
--privileged Give extended privileges to the command
-t, --tty Allocate a pseudo-TTY
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
-w, --workdir string Working directory inside the container
# nerdctl exec --help
Run a command in a running container
Usage: nerdctl exec [flags] CONTAINER COMMAND [ARG...]
Flags:
-d, --detach Detached mode: run command in the background
-e, --env stringArray Set environment variables
--env-file strings Set environment variables from file
-h, --help help for exec
-i, --interactive Keep STDIN open even if not attached
--privileged Give extended privileges to the command
-t, --tty Allocate a pseudo-TTY
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
-w, --workdir string Working directory inside the container
See also 'nerdctl --help' for the global flags such as '--namespace', '--snapshotter', and '--cgroup-manager'.
Nice 👍
powered by Hugo and Noteworthy theme