Search code examples
linuxcontainersrunclinuxkit

Linuxkit where is the container running


Linuxkit is very interesting project so started playing with it. I have created image using redis-os.yml example https://raw.githubusercontent.com/linuxkit/linuxkit/master/examples/redis-os.yml

When i boot redis-os it works but i am not seeing any redis server container, i found redis is running but not able to find where.

(ns: getty) linuxkit-f6b2836a15cb:~# pstree
init-+-containerd---7*[{containerd}]
     |-containerd-shim-+-tini---rungetty.sh-+-rungetty.sh---login---sh
     |                 |                    `-rungetty.sh---login---sh---bash--+
     |                 `-11*[{containerd-shim}]
     `-containerd-shim-+-redis-server---3*[{redis-server}]
                       `-11*[{containerd-shim}]

. when i run list container i am not seeing any redis container

  (ns: getty) linuxkit-f6b2836a15cb:~# runc list
    ID           PID         STATUS      BUNDLE                          CREATED                         OWNER
    000-dhcpcd   0           stopped     /containers/onboot/000-dhcpcd   2022-08-12T21:38:05.40297821Z   root

I can see redis listen on port

(ns: getty) linuxkit-f6b2836a15cb:~# netstat -natp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      421/redis-server
tcp        0      0 :::6379                 :::*                    LISTEN      421/redis-server

Question is where is redis container and how do i get to configuration file or exec container filesystem?


Solution

  • I figured out, yes its in namespace but syntax are little complex compare to docker command.

    (ns: getty) linuxkit-fa163e26c0e8:~# ctr -n services.linuxkit t exec -t --exec-id bash_1 redis sh
    /data # redis-cli
    127.0.0.1:6379> PING
    PONG
    127.0.0.1:6379>