r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

12

u/[deleted] Apr 05 '22

I don’t understand for what Docker is used or in what projects I should use it

20

u/TheNintendoWii Apr 05 '22

Docker is used when you have something that needs a special environment. Let’s say it’s a Python project that needs a lot of packages. Instead of installing everything on each machine you have it on, you build a Docker image with all packages installed, so you can run that and everything’s set up. It also separates the program from the host machine, adding security.

13

u/littletray26 Apr 05 '22

Containerisation allows you to package up your application and all its dependencies into a deployable module / package that runs in its own container

It means you don't have to worry about the configuration of a target environment - your app runs identically, everywhere.

Docker is one of the more popular container solutions / engines.

7

u/truechange Apr 05 '22

If your app is dockerized, it will run in any server/host that supports docker. So whether your app needs Nodejs, PHP, Python, whatever, any docker host will run it.

1

u/zacsxe Apr 06 '22

An image is a file system snap shot with all the necessary components for a(n ideally) small service to run. For example, your application and all its dependencies.

A container is a small portion of a host computer where an image can be run in isolation. It’s like a small computer running inside a host computer. For example, your image above can be run as a container.

Docker is a platform with tools that allows you to do the above things easily.

Kubernetes is a platform that allows you to use and orchestrate containers easily over multiple host computers. These hosts are sometimes referred to as a cluster.

Cloud Kubernetes services are managed services that allow you to use kubernetes clusters in data centers through a cloud provider platforms.

It’s not for a type of project, it’s for how you want to run your apps to handle scale, distribution, complexity.

1

u/lionhart280 Apr 06 '22

So in a work environment for a company you want the environment your Developers, QA, QC, and Production to all work the same.

If your Dev computers have javascript version x.11.1 and your QA machine has v x.11.2 and QC has x.10.4 and Production is running v x.12.1... You can see how code that may work and run on the Dev machine suddenly breaks on some other machines but not others yeh?

Docker basically lets you define a rigid "preset" environment, so it has not just your program inside it but its an entire "glass box" operating system.

You can pre-define any other software you need installed. Like perhaps your application also needs a database to run with it, as well as Redis. So you can have your Docker container come pre-packaged with a ready to go Redis and PostgreSql DB all wired up too.

The user literally just grabs the latest stable copy of your docker container and thats it, its now running!

Old style:

"Make sure you first complete steps 1 to 12, installing this and that and those, and make sure your version of this and that is vx.xx.xx, and also install this, and then set this up, and then get that going..."

New style:

docker run "name-of-your-app"

1

u/Sexual_tomato Apr 06 '22

Imagine instead of buying a security camera and wiring it up in your house with separate low voltage wire drops and building out the system to record video, you got a bunch of old smart phones and put an app on them someone else wrote that streams the live video to a hosting service.

Containers are kind of like building that smartphone and security video service. It removes the requirement of understanding how the internals of an application are deployed and instead lets you focus on the overall system without having to worry about overall system compatibilities like keeping your low voltage lines far away from electrical wiring.

If you ever move to a new house, the wired-up solution can't be ripped out and put in the new home. But the second solution sure can, because each part of the system is in its own container and doesn't depend on the house it's in.