Code Persist
Code Persist
  • 7
  • 587 167
Don't be Lazy use Containers
Docker Containers are essential to running code in production environments. Do you ever write some code and have it fail to run somewhere else, a container will solve that problem in no time! They take no time to spin up and are lightning fast. In this video we'll go over why to use docker containers and create a simple Docker container to run a Node.js web application. Not only will understanding containers help your software development journey, but also increase your devops skills!
💻 Github💻
github.com/code-persist/Docker-Example
🔥 Docker Links 🔥
- Docker Desktop: www.docker.com/products/docker-desktop/
- Docker Docs: docs.docker.com/
- Docker Hub: hub.docker.com/
💿 Music 💿
Song: Tokyo Music Walker - Slowly
License: Creative Commons (CC BY 3.0) creativecommons.org/licenses/by/3.0
ua-cam.com/channels/3lLfvhpPGtwd5qD25cMDcA.html
Music powered by BreakingCopyright: breakingcopyright.com
0:00 The problem
0:20 Container buzz words
1:08 Why not a VM
1:32 Virtualization
3:21 The code
5:39 Demo
#programming #softwareengineering #coding
Переглядів: 21 019

Відео

Is This the Next Python?
Переглядів 24 тис.Рік тому
Nim is a modern language with the syntax of Python, the speed of C, and the extensibility of Lisp. You can do almost anything with Nim from systems programming to high-level development of webpages and apps. If you enjoyed the video a like and sub would be amazing! 🔥 Nim Links 🔥 - Nim Homepage: nim-lang.org/ - Nim Docs: nim-lang.org/documentation.html - Nim Compiler Options: nim-lang.org/docs/n...
Data Collection through Web Scraping and Proxies
Переглядів 2,7 тис.Рік тому
🔥 Bright Data: brdta.com/codepersist Web Scraping is increasingly useful as more services cut their APIs. For some products, it's the only way to get data from the website. In this video, we'll be web scraping the internet with the Bright Data Scraping Browser to prevent many blocks from websites. We'll also look through Reddit and perform sentiment analysis on people's opinions regarding stock...
Does Python Really Need the GIL
Переглядів 21 тис.Рік тому
Python is a great language that can do almost anything. Its ease of use has been one of its greatest features. The Global Interpreter Lock is the opposite and can make it confusing to understand why multithreading doesn't work as you would expect. If you like the video consider subscribing for more like these! 0:00 GIL? 0:56 GIL Uses 1:10 Reference Counting 2:04 Multithreading 3:03 Numpy/IO thr...
Rust, Modern Solutions to Modern Problems
Переглядів 54 тис.Рік тому
Rust is a statically typed compiled language designed around performance and memory safety. Many of its features are considerably modern and solve a large sum of unsafe memory issues targeting computers today. Rust's borrow checker enables developers to write safe code with the power of low-level languages and the syntax of higher-level languages. If you enjoyed the video feel free to hit the s...
Ditch your Favorite Programming Paradigm
Переглядів 183 тис.Рік тому
Programming paradigms define the way our code is written and styled. With modern-day programming, a multi-paradigm approach is getting far more popularized. It's more important now than ever to not have a favorite paradigm as utilizing a multi-paradigm approach can significantly increase your coding quality and efficiency. If you enjoyed the video feel free to hit the subscribe button for more ...
How C++ took a turn for the worse
Переглядів 282 тис.Рік тому
C is a great language to know; however, as time goes on more features are added to the language. These extra features make it far weirder than it used to be. If you liked the video subscribe and hit that like button! 0:35 auto 1:32 STL 2:33 Package Manager 3:22 Error Messages 4:18 Backward Compatability #programming #coding #software #computerscience

КОМЕНТАРІ

  • @dmitrykim3096
    @dmitrykim3096 День тому

    C++ like C# doesnt know what it wants to be

  • @atom1kcreeper605
    @atom1kcreeper605 8 днів тому

    1:09 in my defense its easier to type a single letter and a number tnan a whole word that describes it

  • @syntaxed2
    @syntaxed2 11 днів тому

    I feel like many new features, if not all of them, are catered to huge corporate codebases. Theres also a pattern past releases where the committee will release an overly complicated API, followed by public demands for simplification, and then redesign of such API.

  • @KatteMaggie-b5j
    @KatteMaggie-b5j 12 днів тому

    Jacobi Path

  • @steven1671
    @steven1671 12 днів тому

    1:53 This looks like C# linq code.

  • @TomCaselli-q2u
    @TomCaselli-q2u 15 днів тому

    Hauck Flats

  • @AntenainaLand
    @AntenainaLand 17 днів тому

    Code Persist: it's difficult to deduce what type the "foo" variable is Vanilla JavaScript developers: 👀

  • @karlsassie8403
    @karlsassie8403 20 днів тому

    Skill issue

  • @dadecky5276
    @dadecky5276 23 дні тому

    please make the video about kubernetes

  • @99.googolplex.percent
    @99.googolplex.percent 25 днів тому

    we all hate other languages and love C++ and we all hate C++ as much as we love it

  • @paherbst524
    @paherbst524 26 днів тому

    A lot of this sounds like skill issues.

  • @paherbst524
    @paherbst524 26 днів тому

    I don't understand the obsession with package managers. C++ isn't webdev, you bums.

  • @JJSogaard
    @JJSogaard 26 днів тому

    3:42 - "To be fair, I'm not sure how other languages deal with segfaults..." Well, in Rust you just don't do segfaults. Simple.

  • @chudchadanstud
    @chudchadanstud 28 днів тому

    Great now I have to make the containers work on my machine. Imagine spending weeks learning a system rather than just reading the instructions on the readme?

  • @VioletClaw816
    @VioletClaw816 28 днів тому

    Same goes to VAR in c# so hard to debug that I have to hoverover every time to see what is assigned to that var

  • @OctagonalSquare
    @OctagonalSquare 29 днів тому

    I know it’s not identical, but I had to deal with Python venvs for an API we had at my old job. One thing that we ran into quickly was that you couldn’t push the whole venv by default from the dev to prod servers. Turns out it defaulted to absolute paths for EVERYTHING. So if your python installs were in different places or were 0.0.1 version difference, it would break. Finding all those spots and fixing them was a pain in the butt. So we just only committed the actual code and had it populate INTO the venv on each server respectively

  • @weeb3277
    @weeb3277 29 днів тому

    5:40 what are you running in the other tab with ffmpeg? are you recording this video lol

  • @weeb3277
    @weeb3277 29 днів тому

    4:38 you create .docerignore after you ran COPY . . ? is that how it works?

  • @weeb3277
    @weeb3277 29 днів тому

    4:32 when you are running npm install, where are you installing the packages? on you machine?

  • @kjyu4539
    @kjyu4539 Місяць тому

    thank u

  • @polnio
    @polnio Місяць тому

    I prefere to use nix, because you can specify dependencies and tools that will be locally installed without virtualization. But nice video anyway

    • @amortalbeing
      @amortalbeing Місяць тому

      what's nix?! I've never heard of it!

    • @deidyomega
      @deidyomega 28 днів тому

      Sure for local it's fine, but when you have 50 different software by 50 different devs, all needing port mapping and volume mapping, docker still kicks butt

  • @vitspenatek455
    @vitspenatek455 Місяць тому

    "I don't understand it" != "it's bad". There are always tradeoffs when signing up for a particular language. Things you complain about are done under the hood in the "comfortable" languages, but still have to be done. Ever wondered why people don't use python for low level programming? That fact that you HAVE TO do it yourself implies you CAN do it your way.

  • @meruzhansargsyan1476
    @meruzhansargsyan1476 Місяць тому

    What is your terminal setup? It’s gorgeous

  • @ninetydirectory3798
    @ninetydirectory3798 Місяць тому

    _To err is human; to contain, divine_

  • @sidecharacter9375
    @sidecharacter9375 Місяць тому

    you need 32gb of ram if you are fullstack (go & nuxt) dev, having frontend backend running on your local (using arch linux btw), including vscode, firefox, db client, you'll get 24gb used of ram.

  • @balijosu
    @balijosu Місяць тому

    Zero info from a segv? You literally showed a stack trace...

  • @gabrieltofvesson8164
    @gabrieltofvesson8164 Місяць тому

    I can also strongly recommend Podman. The CLI and functionality is a drop-in replacement for Docker, it has really good support for rootless containers and does away with the Daemon, instead allowing you to register containers/networks/volumes as systemctl services using something called "Quadlets". Super convenient and familiar :)

  • @dae2530
    @dae2530 Місяць тому

    do NOT use containers for node development because it will waste tons of your time... if you want to make sure everything is working, use ci/cd and deploy your app to your dev environment before deploying on production

  • @TheOnlyJura
    @TheOnlyJura Місяць тому

    Or you can just fix your code…

    • @le0nz
      @le0nz Місяць тому

      fix the code, bruh 😂. It's not the code but the environment

  • @computhenics
    @computhenics Місяць тому

    I generally recommend people with no programming experience to start with Python. But, then there comes the risk that when they learn C/C++ they start questioning why things are the way they are in C/C++ compared to Python. If one starts with C or if possible Assembly, they get to live through the era and python (or other interpreted languages) seem like a natural progression from C/C++. With Python, people don't get to learn about memory layout, stack, heap etc. and then they question, "why segfault stack trace isn't as good as python?".

    • @balijosu
      @balijosu Місяць тому

      Agreed, mostly. I tend to recommend C for a first language. Python is great for some things, but it hides too much of what's really going on.

  • @littleblack111
    @littleblack111 Місяць тому

    so no more excuses?

  • @anonymouscommentator
    @anonymouscommentator Місяць тому

    containers can only run linux applications on a linux host. mac and windows need to spin up a vm and use the docker containers inside that vm. also containerizing every single application component just to get it to run on different hosts is like the pinnacle of what is wrong with modern software engineering. something like nix is a much superior concept to containers.

  • @bause6182
    @bause6182 Місяць тому

    "It works on my machine " - "Send me your marchine !"

  • @otocotara
    @otocotara Місяць тому

    the next video needs to be about nix :D

  • @arbelarad1980
    @arbelarad1980 Місяць тому

    "works on my machine" ---- ok so we will ship your machine i use nixOS btw

    • @ARandomUserOfThisWorld
      @ARandomUserOfThisWorld Місяць тому

      I’ve long wondered if arch or nixos is more impressive

    • @VinayKumar-vu3en
      @VinayKumar-vu3en Місяць тому

      ​@@ARandomUserOfThisWorldarch is just linux with a package manager which recieves updates everyday. nix os has a whole philosophy around reproducibility.

    • @rakeshchowdhury202
      @rakeshchowdhury202 Місяць тому

      Nix if you want your software to just work ​@@ARandomUserOfThisWorld

    • @patrickkdev
      @patrickkdev 14 днів тому

      @@ARandomUserOfThisWorld I've been using arch for a while now and I find it really easy, and I came from Ubuntu. I also gave nixOS a shot a while ago, it has a install ui, so it is easy to install. But I found the config language difficult, and that might cause people to find it more impressive.

    • @ARandomUserOfThisWorld
      @ARandomUserOfThisWorld 14 днів тому

      @@patrickkdev ah, makes sense. Also, you probably expected this, but i am legally obligated to say: 'I use Arch BTW'. Also yeah arch does seem better at least for my needs

  • @alexandrunechita3460
    @alexandrunechita3460 Місяць тому

    Containers are NOT ALWAYS reproducible, so the "doesn't work on my machine" happens. In the moment you use a `apt update` or similar you just lost you reproducibility altogether. (The container has a different hash) Nix is a better way to solve this issue and can be used with container. Container is a way to isolate your environment and Nix resolves the problem of building the container image deterministically (yes also nix can be have reproducibility issues but it's basically the exception than the rule)

    • @しめい-l4m
      @しめい-l4m Місяць тому

      do you mean Nix Flakes? Nix itself doesn't solve update problems.

    • @alexstone691
      @alexstone691 Місяць тому

      But tagged containers are the same, if you test on the tag, it will work on same tag on the server

    • @trinhvanquan8443
      @trinhvanquan8443 Місяць тому

      The point of eliminating of “it woks on my machine” is talking about the container itself, it is not the image creation process. So if you trying to build an image from docker file, it is the plain old process outside of container protection.

  • @NexusGamingRadical
    @NexusGamingRadical Місяць тому

    The whole point of the JVM is that you compile to it and it runs anywhere there's a JVM. I've never fully understood why people bother put spring apps in containers when they don't need the isolation

    • @AntonioNoack
      @AntonioNoack Місяць тому

      I'm working at an AEM project at work, and it too is Java/JVM based. I wish a little sometimes I could just use containers to reproduce our AEMaaCS (Cloud AEM) 😅, because by some configuration - most times permissions and occasionally because of IP locks, stuff works differently locally, in cloud testing and in cloud production. Also our application is segregated with more pieces of different versions and code we can't access, just call, and that causes issues, too :/.

    • @philipehusani
      @philipehusani Місяць тому

      Because Kubernetes.

  • @RichardLofty
    @RichardLofty Місяць тому

    OR you could just use a "nontrash" language with cross compilation and static linking. This will ACTUALLY work on any machine. WITHOUT any virtualization, container, vm, whatever else.

    • @AntonioNoack
      @AntonioNoack Місяць тому

      This won't fix the issue completely, as you can see from the following answer on this video: "@catnt6511 5 hours ago Nice video. Something that should be brought up is that sometimes containers don't "just work" on different machines for hardware related reasons. I had a case where everything worked in the development and testing environments, but it kept crashing on startup on an environment another company provided us. Long story short, they had given us access to a VM which didn't have AVX instructions available." Your case still would have failed, because you might have set the AVX bit on your environment, and it would just crash in production.

  • @catnt6511
    @catnt6511 Місяць тому

    Nice video. Something that should be brought up is that sometimes containers don't "just work" on different machines for hardware related reasons. I had a case where everything worked in the development and testing environments, but it kept crashing on startup on an environment another company provided us. Long story short, they had given us access to a VM which didn't have AVX instructions available.

    • @cerulity32k
      @cerulity32k Місяць тому

      Shouldn't there be safeguards to detect for AVX support? Some computers don't support certain SIMD extensions. At least, I've found out the hard way that mine doesn't support AVX512. But maybe there is safeguarding, and that VM doesn't override CPUID correctly, in which case that would be a fault of the VM. If the VM decides not to support something, they should at least make sure they indicate it.

  • @IvanToshkov
    @IvanToshkov Місяць тому

    Please note that there are a lot of simplifications and some inaccuracies in this video. The main benefit that containers provide compared to VMs is that they start much faster. There's also some overhead when VMs access hardware like the disk and networking. However, if you're running the VM directly on a hypervisor as opposed to inside your normal OS, then this overhead is relatively small. VMs on the other hand can run various operating systems, while containers run Linux inside a Linux host. (There are other options too, but this is the most common case.) If you want to run a Linux container on a MacOS or Windows host, the docker desktop actually runs a Linux Virtual Machine, and it runs the containers inside it. And this is an option even on Linux, if you need a different kernel for example. The video seem to suggest to put many things inside the same container. E.g. Postgres and NGINX. This is generally considered a bad practice. Normally you'd put those two in separate containers and let them talk to each other. This allows you for example to scale the two parts independently and to reuse the same containers for different projects. Speaking of scaling horizontally, the video mentions that as if it's something that is magically provided by the containers. They do help in this regard, but your application needs to be written appropriately. For example horizontally scaling SQL databases is hard. The DBMS needs to support it itself. You can't just make many copies of it, unless the DB is used only for reading. You're saying (4:30 on) that the "COPY . ." copies the things installed by the previous command inside the image. This is not true. The "COPY . ." command copies the rest of the source code, pictures, etc. from your local folder to the container. It doesn't copy the things installed by "RUN npm install" as they are already installed inside the image. Overall, to get the most out of containers one would need to understand their benefits and shortcomings and to design the application appropriately. Making it sound like they are better than they are only creates problems.

    • @codepersist
      @codepersist Місяць тому

      Thanks for the additional information! I was trying to explain a high level / basic approach on the benefits of docker. Your comment is more in depth and a great addition!

    • @IvanToshkov
      @IvanToshkov Місяць тому

      @@codepersist I know how hard it is to include just the right amount of info. I think you did a pretty good job with that.

    • @IvanToshkov
      @IvanToshkov Місяць тому

      @@anonymousalexander6005 I'm not sure I understand your point about the type 1 and type 2 hypervisors and containers. Can you please elaborate? P.S. I find the "bare metal hypervisor" and "hosted hypervisor" more descriptive, and thus better, than "type 1" and "type 2". I always have to check which was which :) Putting several services in the same container only makes sense if thy do scale together. It might be better sometimes, but it is the special case. That is, if you put them together you can only scale them together. If you put them separately you have more options (including a 1 to 1 scaling). The special case might have some benefits, but the general one is still better fit for this video IMO.

  • @tsunekakou1275
    @tsunekakou1275 Місяць тому

    just write good cross platform code, no need containers... easy.

  • @hmmmza
    @hmmmza Місяць тому

    What software do you use to make these videos?

  •  Місяць тому

    It worked on my machine. We have the same container! Virtualization software just casually stops working properly.

  • @swapnilchand338
    @swapnilchand338 Місяць тому

    how are you getting code completion in your command line? is it copiilot cli? trying to find a free or cheap alternative but couldn't for windows. idk why codexcli doesnt work

    • @codepersist
      @codepersist Місяць тому

      Im just using zsh with zsh-autosuggestions. You can look into oh-my-zsh along with zsh to get a similar setup. You may have to use WSL if your on windows, but I am not 100% sure

  • @seasong7655
    @seasong7655 Місяць тому

    What if the hardware is different?

    • @codepersist
      @codepersist Місяць тому

      Thats why containers are so great! You can create a container on your computer and as long as the other computer supports containers (they almost always can), the code will run the same on both your local environment and the external hardware! Containerization has streamlined a lot of production environments allowing devs to develop and test code locally on an environment that is a 1 to 1 copy of the production environment

    • @alexandrunechita3460
      @alexandrunechita3460 Місяць тому

      ​@@codepersist mostly true but slightly inaccurate, if your program is dependent for CPU extensions like AVX, and your host machine or VM does not support it it's not going to work But for "normal mortals" different hardware isn't something that is gonna cause issues :) Happy coding

  • @xerathgaming1915
    @xerathgaming1915 Місяць тому

    instead of focusing on a programming paradigm you should focus on writing good code

  • @Kitsune_Dev
    @Kitsune_Dev Місяць тому

    can you talk about Test Driven Development and Game Programming?

  • @twenty-fifth420
    @twenty-fifth420 Місяць тому

    Me, when I start open source: "It works on my machine!" My fellow contributor: "It doesn't on mine!" Also me: *UNINSTALLS GITHUB*

  • @Coolkid245
    @Coolkid245 Місяць тому

    You’re back!! Awesome video!

  • @crazygermanviper
    @crazygermanviper Місяць тому

    "As a modern Python Developer" you lost me there