$30 off During Our Annual Pro Sale. View Details »

Integrating Containers Into JavaScript

Integrating Containers Into JavaScript

Lucas Santos

May 14, 2021

More Decks by Lucas Santos

Other Decks in Technology


  1. Integrating containers in JavaScript the good, the bad, and the

  2. cloud advocate_ who am I_ ludossan@microsoft.com {twitter, facebook, linkedin…}.lsantos.dev

  3. containers are a thing_

  4. it’s easy to control them

  5. if you are human_

  6. what if you’re not?

  7. then we use containerd - High-level runtime (runtime manager) created

    by the Open Container Initiative - Powers Docker - Created to be manipulated through code
  8. not so easy for JS devs

  9. Golang predominance

  10. Then I came across this article_

  11. What if I did this using Node.js?

  12. The first attempt sometimes good, mostly bad, but always ugly

  13. use child-process

  14. pros - Super easy - Takes advantage of ctr’s built

    in features - Faster implementation - Can be integrated with any external API
  15. so easy that I built this

  16. to the code

  17. cons - heavily dependent on environment - no complete control

    over the process - Limited to parsing the string outputs - Error handling is poor - Needs sudo - Input sanitizing
  18. conclusion: we can integrate containers into JS

  19. but I wanted a real integration

  20. The second attempt mostly good, sometimes bad, kinda pretty

  21. containerd was meant to be extended

  22. but you need to know how to do it

  23. None
  24. None
  25. but it is possible

  26. to the code

  27. pros - Proper error handling - Proper return codes -

    Allows you full control of the pipeline - Does not need to be in the same machine - Does not require sudo - Native (gRPC module)
  28. cons - Requires a LOT of knowledge in containers -

    Sparse documentation both for gRPC and containerd - Harder - Might be a problem to connect to external servers - CRT certificates and so on
  29. Next steps what can we do next?

  30. let’s make this a good tool

  31. Let’s add more knowledge to the Web!

  32. refs_ - github.lsantos.dev/containerd-integration-example - github.lsantos.dev/js-containerd-example - github.lsantos.dev/containerd-js - Mark’s article

    bit.ly/containerd-grpc-web These Slides: - slides.lsantos.dev/integrating-containers-into-javascript
  33. thank you_ info.lsantos.dev