Categorygithub.com/jijosg/containers-in-go
repositorypackage
0.0.0-20240219090212-bf95dfdbcf1b
Repository: https://github.com/jijosg/containers-in-go.git
Documentation: pkg.go.dev

# README

all-about-containers

I created this repo to list down all my learnings that i took in my journey to learn Kubernetes.

The following steps assume you have basic understanding of Linux

Setup Go and run go run main.go run /bin/bash as root user in Windows(wsl)/Linux/Mac

Usage of main.go

Run the program as root user, as chroot only works with root user. Test by running the ps command, pid's should start with 1 if its a new container.

jijosg@hostname:/mnt/c/sandbox/learn/containers-from-scratch$ sudo su -
[sudo] password for jijosg:
root@hostname:~# cd /mnt/c/sandbox/learn/containers-from-scratch
root@hostname:/mnt/c/sandbox/learn/containers-from-scratch# go run hello.go run /bin/bash
Running [/bin/bash]
Running [/bin/bash] with pid 1
root@container:/# ps -fax
  PID TTY      STAT   TIME COMMAND
    1 tty1     Sl+    0:00 /proc/self/exe child /bin/bash
    6 tty1     S      0:00 /bin/bash
    8 tty1     R      0:00  \_ ps -fax