Building a container from scratch in Go - Liz Rice (Microscaling Systems)

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ส.ค. 2024
  • Everyone has heard of Docker, but what is a container? Is it really "a lightweight VM"? In this talk we'll dispel the magic by writing a container in about 100 lines of Go.
    Liz Rice has a wealth of software development, team, and product management experience from her years working on network protocols and distributed systems as well as in digital technology sectors including VOD, music, and VoIP. When not building startups and writing code, Liz loves riding bikes in places with better weather than her native London.

ความคิดเห็น • 101

  • @artvandelay777
    @artvandelay777 6 ปีที่แล้ว +119

    I finally think I understand what a Docker container is! Thanks.

    • @sussus4914
      @sussus4914 2 ปีที่แล้ว +5

      Her 50 lines of GO lang code hides over a 100 levels of OS level abstraction, and you confidently say that you think you understand what a Docker container is. That's laughable.

    • @safiahmed7955
      @safiahmed7955 ปีที่แล้ว +8

      @@sussus4914 so why don’t you give a talk on those 100 lines of OS abstraction?

    • @milanpanic3755
      @milanpanic3755 5 หลายเดือนก่อน +3

      @@sussus4914precisely why they are abstractions, so you don’t get distracted with boilerplate

  • @RichardBuckerCodes
    @RichardBuckerCodes 3 ปีที่แล้ว +6

    The best part of this demo is that it makes containers more like jail and addresses the trust issue.

  • @HassanSani
    @HassanSani 5 ปีที่แล้ว +35

    Wow the way you make things feel simple, now I'm even a go pro developer

  • @shahmiBro1
    @shahmiBro1 4 ปีที่แล้ว +18

    Loving demos cause it shows the real things in practical world, always intrigued to watch her demos;

  • @jonbv2434
    @jonbv2434 3 ปีที่แล้ว +6

    this is by far very short and well explained how the container can expand the possibilities how GO can do it.

  • @johnschiwitz4412
    @johnschiwitz4412 5 ปีที่แล้ว +17

    one of the best container talk i've heard

  • @loupax
    @loupax 2 ปีที่แล้ว +1

    Looks like my favorite presentations are those that start so simple you almost think they are jokes, until suddenly they are not.

  • @gangsterholla179
    @gangsterholla179 2 ปีที่แล้ว +7

    This was amazing. Simple and easy to digest, but packed with information.

  • @mattt2684
    @mattt2684 5 ปีที่แล้ว +23

    I loved this talk!

  • @iknownothing13
    @iknownothing13 6 ปีที่แล้ว +3

    That's very inspiring, especially Liz shows her charm by unique humor and coding flow.

  • @mahdijh1
    @mahdijh1 3 ปีที่แล้ว +2

    Thanks, It was the best way someone can show me concept of a container.

  • @afortiorama
    @afortiorama 6 ปีที่แล้ว +15

    This was an excellent presentation, thanks!

  • @abstractplanet6018
    @abstractplanet6018 3 ปีที่แล้ว +2

    Made me want to learn Go. Thanks.

  • @konstantingeyst4568
    @konstantingeyst4568 9 หลายเดือนก่อน +1

    Note that child processes can call chroot() again and break outside of this container easily. Docker doesn't use chroot.

  • @actsrv9
    @actsrv9 4 ปีที่แล้ว +1

    All big words should be explained like this.

  • @billvvoods
    @billvvoods 2 ปีที่แล้ว

    Awesome video and a great intro to how containers are constructed

  • @anshubehera2600
    @anshubehera2600 3 ปีที่แล้ว

    "You are my peer reviewers"... what a lass

  • @evilsdexter5261
    @evilsdexter5261 5 ปีที่แล้ว +6

    why can't I give 1000 likes to this one? :)

  • @rohitm8526
    @rohitm8526 ปีที่แล้ว

    Woah... very nice explanation 🔥

  • @abhinjose
    @abhinjose 5 ปีที่แล้ว +2

    Thanks, That was cool and easy to understand!

  • @MoAliDevOps
    @MoAliDevOps 7 ปีที่แล้ว +19

    The talk really begins at 2:25
    You're welcome.

  • @jasonguo7596
    @jasonguo7596 5 ปีที่แล้ว +2

    This is awesome!

  • @xinli4938
    @xinli4938 6 ปีที่แล้ว +2

    Great Demo!

  • @codelucky
    @codelucky 3 ปีที่แล้ว +2

    Did I just watch Go programing in Downtown Abbey?

  • @gscacco
    @gscacco 5 ปีที่แล้ว +1

    Great work !

  • @freakybaby1012
    @freakybaby1012 3 ปีที่แล้ว +2

    Great tutorial thank you!

  • @KevinCantwell
    @KevinCantwell 7 ปีที่แล้ว +21

    This is a fantastic presentation, thank you! I notice that you quickly gloss over installing a root file system ("I just happen to have one lying around"). I'm not familiar with installing linux file systems and my attempts at doing so are apparently too naive to work. Is there a straightforward way to download or copy one?

    • @cyphaetus
      @cyphaetus 7 ปีที่แล้ว +6

      For ubuntu:
      apt-get install lxc
      sudo lxc-create -t ubuntu -n yakkety
      # now use this for the chroot /var/cache/lxc/yakkety/rootfs-amd64
      # I still had to `run mount -t proc proc /proc` to get ps to work though, not sure how to get around that

    • @theoutsider01
      @theoutsider01 7 ปีที่แล้ว +1

      I could do this by creating a chroot filesystem. help.ubuntu.com/community/BasicChroot

    • @deepspaceninefreak
      @deepspaceninefreak 6 ปีที่แล้ว +2

      debootstrap stretch test1

  • @sunwoojang6888
    @sunwoojang6888 3 ปีที่แล้ว +1

    really good

  • @ahmedifhaam7266
    @ahmedifhaam7266 2 ปีที่แล้ว

    great explanation. Thank you 👍

  • @KeithMakank3
    @KeithMakank3 2 ปีที่แล้ว

    Really good talk

  •  6 ปีที่แล้ว +2

    Great impressive Demo

  • @johnschiwitz4412
    @johnschiwitz4412 5 ปีที่แล้ว +1

    hope to see you at kubecon nice video

  • @reprC
    @reprC 4 ปีที่แล้ว +1

    Awesome stuff. Any reason that calling /proc/self/exe was done rather than syscall.ForkExec? She mentioned that it does the same thing. Just because the copy-paste portion is faster for the demo? Minimizing the Go-specific parts since ForkExec is a convenience method and takes a Go struct? Not criticizing, just curious

  • @zakariachahboun
    @zakariachahboun 2 ปีที่แล้ว

    Thanks

  • @dengan699
    @dengan699 5 ปีที่แล้ว +1

    very good, thanks

  • @hamed775
    @hamed775 6 ปีที่แล้ว

    ............Excellent .................

  • @derekreed6798
    @derekreed6798 ปีที่แล้ว

    Nice

  • @abhirishi6200
    @abhirishi6200 6 ปีที่แล้ว

    excellent video

  • @mithleshmeghwal7093
    @mithleshmeghwal7093 5 ปีที่แล้ว

    awesome lizrice

  • @techindia3602
    @techindia3602 3 ปีที่แล้ว +1

    Does anyone have the link to the talk by Julian Friedman she is talking about ?

  • @izzzzzzza
    @izzzzzzza 6 ปีที่แล้ว

    awesome, thanks!

  • @TheBendixSA
    @TheBendixSA 2 ปีที่แล้ว

    Badass

  • @RockwellAIM65
    @RockwellAIM65 ปีที่แล้ว

    Where is the network stack+virtualization for that? How does that work?

  • @generosonunezarias369
    @generosonunezarias369 4 ปีที่แล้ว

    Badass!

  • @obrien8228
    @obrien8228 ปีที่แล้ว +1

    wait this is so easy

  • @liuyanjun6693
    @liuyanjun6693 6 ปีที่แล้ว

    very impressive demo

  • @metaorior
    @metaorior 6 ปีที่แล้ว

    good afterneen

  • @LilRofl
    @LilRofl ปีที่แล้ว

    🤯

  • @joepoptiya
    @joepoptiya 2 ปีที่แล้ว

    Really good walk through.
    The container doesn't have internet access. Is there a way to provide the container with internet access?

  • @piyushsingh178
    @piyushsingh178 2 ปีที่แล้ว

    wow..this is super awesome!! ps not showing host processes was very nice. But why Go though. As someone who doesnt speak Go, what I understood was you did some syscalls, cloned UTS namespace, changed rootdir, and invoked a new /bin/bash as a fork process. Same thing can be done in any language cpp/python/java right?

    • @RockwellAIM65
      @RockwellAIM65 ปีที่แล้ว

      Efficiency. You can build a completely self-contained binary that does everything. If you add https or a straight TLS socket you only need the exe and a cert file... it's super clean.
      With Python you may have versioning/suppor issues.
      Java is a pig - it latches onto cpu+memory resources. Not really apropos.
      C++ is ok for this, but younger engineers may not know it + unix command programming in C++ can be a bit tricky. Golang makes it (and certain other tasks) pretty straightforward.
      I would use either C or golang. Maybe Rust but I don't know it yet.

    • @piyushsingh178
      @piyushsingh178 ปีที่แล้ว

      @@RockwellAIM65 yeah I think outside of Go, c++ would be the best choice

    • @RockwellAIM65
      @RockwellAIM65 ปีที่แล้ว

      @@piyushsingh178 A C based solution would be clean; you'd have to add lots of external libraries tho' ... would have been nice if C had a standard add-on for managing databases, doing all the simple network type transactions w/ a second thread perhaps (application+background processing thread) + an easy-to-interface string based hierarchical data store. C++ wasn't really necessary... it turned into the Cobol of the 1990s!

  • @GerinoMorn
    @GerinoMorn 10 หลายเดือนก่อน

    Why am I watching 7yo video about sth I don't do very often in a language I don't use, I don't know. But it''s good xD

  • @marccawood
    @marccawood 4 ปีที่แล้ว +1

    I thought Linux supported containers/virtualization natively (LXC) - why is she faking container isolation by e.g. mounting alternative file systems?

    • @l1703
      @l1703 4 ปีที่แล้ว +2

      How is she faking it ?

    • @reprC
      @reprC 4 ปีที่แล้ว +4

      When did she mount an alternative fs? When she mounted proc? Or do you mean the chroot? The chroot source dir already contains a file system hierarchy because the child process quite literally has a different root, and would not be able to access anything “outside”. Without this, calling /bin/bash would do nothing since that path wouldn’t even exist. Mounting proc is required purely because of the chroot. LXC isn’t a “native” feature, cgroups are. LXC is just one of several system virtualization frameworks such as libvirt or systemd-nspawn. Her talk was about making containers from scratch, which I’ll interpret as a LSB compliant OS with a vanilla Linux kernel. LXC under the hood does pretty much the same thing as her code. Go ahead and check out their github; it’s all open-source. LXC has more features, but I’m pretty sure it’s quite a bit bigger than 60-ish lines

  • @cookiebinary
    @cookiebinary 6 หลายเดือนก่อน

    TL;DR: chroot && mount proc

  • @pclokcer
    @pclokcer 2 ปีที่แล้ว

    Likee

  • @GreyDeathVaccine
    @GreyDeathVaccine ปีที่แล้ว

    Too much weird sounds from Liz (don't how to say it since I am not good with english) but good presentation.

  • @SuperMarkusparkus
    @SuperMarkusparkus 6 ปีที่แล้ว +4

    I'm not sure it really explained what a container is or how it works. I just showed what result a few lines of go code had, but what really happened?

    • @kevint6878
      @kevint6878 5 ปีที่แล้ว +6

      For me it was the fact that I always sort of imagined containers as this mystical thing. I use them all the time, but I never really thought about how they are created or work under the hood. Seeing this video really opened up my mind to how simple it really is. Of course I know there is so much more to containers than that, but just seeing how she could give the processes their own namespace, their own processes, their own “isolation”, is really interesting and impressive for just 56 lines of code.

    • @foljs5858
      @foljs5858 4 ปีที่แล้ว +1

      If you follow what it shows, you'll also see what happened. It gave the program it run isolation (not messing with the environment outside), it's own root (not seeing outside a particular directory), and a few other similar things. That's what a container like Docker does, using several OS provided utilities (like chgroups, chroot, etc), like this program does (in a more basic way)

  • @idiotshypocrites9547
    @idiotshypocrites9547 2 ปีที่แล้ว +1

    Min 05:00 and I don't know what the heck she is doing. And yes as she said, this is quite dull. And Go, why?

  • @fardeadok
    @fardeadok 5 ปีที่แล้ว

    “Sublime” editor?

  • @matthijshebly
    @matthijshebly 5 ปีที่แล้ว +2

    Good presentation.
    One thing, however: Why the need for go? Couldn't all this have been done in plain bash? After all, all she's doing is calling system commands.

    • @markotikvic
      @markotikvic 5 ปีที่แล้ว +3

      Why the need for programming languages at all? After all, all they do is translate human readable code to bunch of machine instructions. Just write those instead.

    • @bt82
      @bt82 5 ปีที่แล้ว +5

      Docker is written in go.

    • @kirasan
      @kirasan 5 ปีที่แล้ว +1

      She compared the length of her code to Docker's in the end, so it had to be written in Go.

    • @foljs5858
      @foljs5858 4 ปีที่แล้ว +3

      Yes, it could be done in plain bash. But it would be hell to maintain, scale, and make able to run arbitrary containers. Whereas this shows how a container manager like Docker does it (of course with much less functionality here), so it can be more easily extended configurable etc.

  • @idiotshypocrites9547
    @idiotshypocrites9547 2 ปีที่แล้ว +1

    06:35 cringe, with respect for trying

  • @NyttNorge
    @NyttNorge 6 ปีที่แล้ว

    What was the point of this program again?

    • @markotikvic
      @markotikvic 5 ปีที่แล้ว +9

      Trust me, nobody is surprised that a flat earth proponent is not able to understand something very basic.

    • @kirasan
      @kirasan 5 ปีที่แล้ว +1

      The point was to run a container without docker.

    • @foljs5858
      @foljs5858 4 ปีที่แล้ว

      Isn't it OBVIOUS? To show how the basics with which a container system like Docker can be implemented...

    • @reprC
      @reprC 4 ปีที่แล้ว +1

      What was the point of this comment again?

  • @Jone952
    @Jone952 5 ปีที่แล้ว +2

    Was expecting a token female the managers stuck out front then she started coding live lol

    • @shailynortiz
      @shailynortiz 4 ปีที่แล้ว +1

      Very skewed view of the tech world where most of the innovation is done by women since the beginning of the time.

    • @Jone952
      @Jone952 4 ปีที่แล้ว

      @@shailynortiz def not true

    • @JosueRodriguez08
      @JosueRodriguez08 3 ปีที่แล้ว

      @@shailynortiz lol, not true

    • @automatic241
      @automatic241 3 ปีที่แล้ว

      @@shailynortiz I think both views are skewed. Females are not recognized for their accomplishments in the tech world, but saying they've done the majority of innovation in that field is simply not true.

  • @alexwexov4298
    @alexwexov4298 2 ปีที่แล้ว

    Came for Vim, saw Sublime, leave.

  • @dukearchon
    @dukearchon 6 ปีที่แล้ว +10

    I stopped listening once she said,"... on my Mac..."

    • @snoooters
      @snoooters 6 ปีที่แล้ว +18

      that's a cool story

    • @alexkozadaev911
      @alexkozadaev911 6 ปีที่แล้ว +38

      You got to be running the TempleOS or something to be that arrogant.

    • @coreyreichle1921
      @coreyreichle1921 6 ปีที่แล้ว +3

      Alex Kozadaev nope, just not a proprietary os on proprietary hardware both designed to restrict your freedoms.

    • @coreyreichle1921
      @coreyreichle1921 6 ปีที่แล้ว +2

      An Enemy nope. Linux.

    • @alexkozadaev911
      @alexkozadaev911 6 ปีที่แล้ว +14

      Corey Reichle makes sense. I also prefer Linux and OpenBSD and cannot see myself ever buying a Mac, however as we can see in this presentation despite of what you said it won’t stand in a way of doing cool stuff either :)

  • @chiragsingla.
    @chiragsingla. 3 ปีที่แล้ว

    Thanks