Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker Is the New Package Manager: Making Local Development a Breeze

Docker Is the New Package Manager: Making Local Development a Breeze

Not too long ago if you wanted a MySQL or Redis server for local development you would install one via your operating system's package manager. This posed a slew of challenges (if it was even there to begin with). To name a few: the version was most likely out of date or didn't match what you used in prod, there was probably a configuration error with a local config somewhere, separating data and instances from other projects was a headache.

The days of Googling an obscure error message after running brew install are behind us. Docker has entirely replaced local installs of dependency services for many developers and become a staple for building things. In this session we'll take a look at how you can make your life easier by accepting Docker as your lord and package manager. You'll leave knowing everything you need to use Docker for local development and how you can ensure you're as close to production as possible.

3f8f51e1aa14cdd87cffeaa26bb0ce13?s=128

Eddie Zaneski

August 08, 2019
Tweet

Transcript

  1. digitalocean.com Docker Is The New Package Manager: Making Local Development

    A Breeze Eddie Zaneski @eddiezane
  2. None
  3. None
  4. Thanks, Greg Levenhagen!

  5. https://www.instagram.com/p/B0j1d6pgJxa/

  6. digitalocean.com #SammyDoesThat19 @DigitalOcean

  7. None
  8. None
  9. None
  10. None
  11. digitalocean.com What is a package manager?

  12. digitalocean.com –Wikipedia “A package manager … is a collection of

    software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer's operating system in a consistent manner.”
  13. digitalocean.com History of package managers • Source / tarball from

    FTP / mailing lists ◦ ./configure ◦ make ◦ sudo make install • .deb or .rpm ◦ YUP → YUM → DNF ◦ dpkg → (deity) dselect → APT ( 21 years old!) https://opensource.com/article/18/7/evolution-package-managers
  14. https://www.lavandeira.net/2015/08/relearning-msx-19-assembly-language-concepts/

  15. digitalocean.com Examples of modern package managers • Windows - Chocolatey,

    Scoop ◦ "The sane way to manage software on Windows" • Windows Update • APT - Debian • Homebrew - macOS (+ Linux) • npm - Node.js • NuGet - .NET • pip - Python • Google Play - Android
  16. None
  17. None
  18. https://stackoverflow.com/a/56962235/959953

  19. https://stackoverflow.com/a/8913870/959953

  20. digitalocean.com Package Managers in Summary • Take many forms •

    Get the software you need and their dependencies
  21. digitalocean.com What is a container?

  22. digitalocean.com –Docker "A container is a standard unit of software

    that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another." https://www.docker.com/resources/what-container
  23. None
  24. None
  25. None
  26. digitalocean.com Codes

  27. None
  28. digitalocean.com Docker Network and Links • Used to connect multiple

    containers together • Service discovery and DNS magic • (Don't use links)
  29. digitalocean.com Codes

  30. None
  31. digitalocean.com Docker Volumes • Used for persistent storage amongst containers

    • Can share volumes between containers • Absolute path vs named volume • Useful for dev and prod • Don't run databases in Docker—use a managed service!
  32. digitalocean.com Codes

  33. None
  34. digitalocean.com Building containers

  35. None
  36. digitalocean.com docker-compose

  37. digitalocean.com docker-compose • Orchestrate Docker operations and complex setups •

    Isolated projects • Free clean up
  38. digitalocean.com Codes

  39. None
  40. digitalocean.com https://github.com/dockersamples/example-voting-app

  41. digitalocean.com Bonus

  42. digitalocean.com Bonus • Multiple versions • Easy clean up •

    Disposable • Build/compile inside a container • Open source Dockerfiles
  43. digitalocean.com Gotchas

  44. digitalocean.com Gotchas • Files created in the container are root

    (uid: 0, gid: 0) ◦ chown -R ◦ -u 1000:1000 (your UID, GID) • Bind to 0.0.0.0 • Read the README's for Docker Hub images ◦ Lots of environment variable options • Container sizes are hard to get right • "Best practices" • Stateful • RTFM
  45. digitalocean.com Thanks! @eddiezane