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

2

u/[deleted] Apr 05 '22

What is deployment? I could never understand the purpose of Docker.

10

u/tzaeru Apr 05 '22

Consider a typical web application. It runs on a particular server. That server needs particular software to support the application.

Let's say your application needs Python version 3.6 and Postgres version 10.

You can manually install those on the server, but you would have to do that again for each server where you run your application.

Containerizing an application is a way of bundling the dependencies together. Instead of running your application on a server that already has the required components installed, you run your application as a Docker container which already has the required dependencies. So the server you host your application on doesn't need to know about Python or Postgres; It only needs to know about Docker. Docker takes care of all the dependencies required by your application.

This also makes it easier for you to run multiple applications with incompatible dependency requirements. Perhaps you have another application that requires Python 3.7 and Postgres 11. You could install those on the same server, but you would need to run the Postgres instance in a separate port and you may run into trouble with where Python3 points to. But if this application is also bundled in a Docker image, it doesn't matter - you just run that Docker image and again it takes care of the dependencies.

→ More replies (7)

3

u/HecknChonker Apr 05 '22

When you write code you need it to run somewhere so users can access it. This used to mean buying a computer that sits in your office and runs your code, but eventually large companies set up data centers with many computers and they let other people run their code there.

But different apps need different configurations. And sometimes you want to run many copies of the same app, and when you make a change you want to update all of them with that same change. Pushing out those changes is called a deployment, as you deploy code to a bunch of servers.

Docker helps in automating this process. You can set up your application to build a docker image, and that image can run in a data center that someone else manages. The docker image contains an operating system, your code, and any required dependencies your code needs.

→ More replies (1)