5 Replies - 289 Views - Last Post: 22 April 2020 - 11:03 AM

#1 O'Niel   User is offline

  • D.I.C Addict

Reputation: 25
  • View blog
  • Posts: 584
  • Joined: 13-September 15

Docker

Posted 22 April 2020 - 06:41 AM

So, I just started a tutorial on Docker. The first question I wanted solved was "Why would anyone use this?". It's pretty cool that you can download/make images and execute commands in these images (which can be other operating systems).

Would one use of Docker be the following?:
I develop web-applications, but right now I develop them on my Mac and copy the code/project to a Linux server to launch it. This way I have import the database structure, configuration,.. all manually on the server. And everyone knows the problem that your code works perfectly on your own laptop, but as soon as it gets copied on the webserver it suddenly doesn't anymore.

Would I be able to make an image from my webserver, make a docker container from it, and develop my application directly on that container? That way I know sure that if my app works on the container it also works on my server (because it's the same OS and whatnot).

Maybe there is also a possibility to automate things? So I don't have to copy the database I made for the webapplication and stuff from my docker container to my webserver?

Is This A Good Question/Topic? 0
  • +

Replies To: Docker

#2 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3136
  • View blog
  • Posts: 11,945
  • Joined: 03-December 12

Re: Docker

Posted 22 April 2020 - 06:50 AM

You actually summed up why anyone would use it.

For your use cases it may not make much sense to deploy a container to a single server. When I have auto scaling services that create as many servers as I need to handle the current load, it's a different type of problem.

As you also mentioned, mitigation of "It works on my machine". If every machine is running the same things, you have repeatability.
Was This Post Helpful? 0
  • +
  • -

#3 Ornstein   User is offline

  • D.I.C Head

Reputation: 103
  • View blog
  • Posts: 210
  • Joined: 13-May 15

Re: Docker

Posted 22 April 2020 - 07:03 AM

Quote

I develop web-applications, but right now I develop them on my Mac and copy the code/project to a Linux server to launch it. This way I have import the database structure, configuration,.. all manually on the server. And everyone knows the problem that your code works perfectly on your own laptop, but as soon as it gets copied on the webserver it suddenly doesn't anymore.


Things may have changed recently, but I'm pretty sure Docker containers aren't cross-platform i.e. you can't take a Windows container and then run it on Linux.

If you're having this much trouble with the OS layer, maybe a virtual machine would be useful to you.

Quote

Would I be able to make an image from my webserver, make a docker container from it, and develop my application directly on that container? That way I know sure that if my app works on the container it also works on my server (because it's the same OS and whatnot).


I'm not entirely sure how you imagine this working or how it's any different from your first question.

Off the top of my head, below are some of the main reasons you might use it:

1. As each container is its own mini-sandbox, you don't have to worry so much about conflicts between containers. This is especially apparent in not having to worry about conflicts between versions of installed softare e.g. you might have one website run in a container with PHP 5 and another run PHP 7.

2. If you're going down the whole "microservices" architecture route, you may break your application up into stand-alone systems which you may find it easier to run in their own containers on the same server, with the option to more easily move them elsewhere in the future.

3. I believe you can place resource usage limits on containers - which again gives you more fine-grained control (e.g. throttling certain websites running on the same server - or throttling unimportant systems to free up resources for more important systems, etc)

4. All of the voodoo you can do with things like auto-scaling and Kubernetes and such, as alluded to by astonecipher above.

Does that give you enough to work with?

(I feel obligated to include a warning here that there's quite a few technologies that get overhyped which leads to people shoehorning them into use cases where they have no business - and Docker is one of them. Don't be suckered into using it because it's what people insist you should be doing; if you're using it, make an informed decision.)
Was This Post Helpful? 0
  • +
  • -

#4 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3136
  • View blog
  • Posts: 11,945
  • Joined: 03-December 12

Re: Docker

Posted 22 April 2020 - 07:31 AM

View PostOrnstein, on 22 April 2020 - 09:03 AM, said:

Things may have changed recently, but I'm pretty sure Docker containers aren't cross-platform i.e. you can't take a Windows container and then run it on Linux.


Correct. Linux containers can be run on Windows or Linux hosts, Windows containers can only be run on Windows hosts.

View PostOrnstein, on 22 April 2020 - 09:03 AM, said:

(I feel obligated to include a warning here that there's quite a few technologies that get overhyped which leads to people shoehorning them into use cases where they have no business - and Docker is one of them. Don't be suckered into using it because it's what people insist you should be doing; if you're using it, make an informed decision.)

Also agree here. It is a good thing to know, because companies do use it. But, if you are using it, you should also know why and what problem it solves for you.
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6865
  • View blog
  • Posts: 31,644
  • Joined: 10-May 07

Re: Docker

Posted 22 April 2020 - 08:55 AM

One place where I was introduced to Docker would be if a webservice experiences a large influx of traffic, then new docker containers could be spun up to quickly handle the influx, then spin down once the traffic has been mitigated or the threshold period is over. It also allows for specific versions of software to be launched, & while interesting, I don't see a need for that in what I do in server administration.
Was This Post Helpful? 0
  • +
  • -

#6 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 1027
  • Posts: 3,951
  • Joined: 13-June 14

Re: Docker

Posted 22 April 2020 - 11:03 AM

Docker is a great piece of software. For personal things, it means having to install less stuff on my machine. Examples:

- Some of my projects use various databases (Mongo, Postgres, ...), so I can just spin up a container for those and not worry about having to configure stuff on my box. Then there's the fact that I often have multiple projects that might use the same kind of DB, so I can have a container for each one.

- I use different machines - a Mac at work and Linux at home and want to work on personal stuff on both. If the stuff can be run in a container, again that's less to manage. I did a tiny project in Go recently and just used their image to spin up a container just to do the build. I've also got a little Clojure setup I like to use that's Dockerised.

At work, we aren't deploying services in containers. We are using Docker for local development (like having containers for databases, message queues and other services), but crucially also on our build servers. Different teams have different build processes (tooling, dependencies, whatever else), but we use the same CI/CD infrastructure with building done inside Docker containers. At least on my team (and probably others), we have a Docker image containing our dependencies so that they don't have to be downloaded on each build.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1