Need a Sum­mer Week­end Project? Try Docker

Maximum PC - - QUICKSTART - Alex Camp­bell is a Linux geek who en­joys learn­ing about com­puter se­cu­rity. Alex Camp­bell

IF YOU WANT to make the most out of a VPS, home server, or NAS, learn­ing how to use a con­tainer sys­tem, such as Docker makes life a lot eas­ier, es­pe­cially if you want to run mul­ti­ple web apps, such as WordPress or Plex. Luck­ily, con­tain­ers aren’t so scary to learn or use….

I used to be skep­ti­cal about the whole con­tainer and Docker thing. “Why would I want a con­tainer when I can just in­stall things like I’m used to?” I would ask the void. The an­swer is pretty easy to un­der­stand when you try to in­stall more than one app.

If you’ve ever run a server at home or on a shared host, up­grad­ing an app can be a touchy ex­pe­ri­ence. Some ap­pli­ca­tions rely on spe­cific fea­tures of their de­pen­den­cies, or soft­ware that the app re­lies on to run. When up­grad­ing your app, the new ver­sion may rely on an up­dated de­pen­dency. But if you’re run­ning an­other app along­side your web ap­pli­ca­tion—like a data­base, for ex­am­ple—that app may cease to func­tion prop­erly if the de­pen­dency is up­graded.

An­other sit­u­a­tion is com­mon: A web app—such as WordPress—up­dates it­self, but re­quires a new ver­sion of some un­der­ly­ing soft­ware, such as PHP. If you up­grade too soon, your dis­tro may not have the new ver­sion of the de­pen­dency avail­able in its repos­i­to­ries, leav­ing you with er­rors in the web app.

Con­tain­ers solve this prob­lem by do­ing some­thing that had be­fore been the pre­serve of vir­tual ma­chines. Un­like vir­tual ma­chines, con­tain­ers don’t re­quire ex­clu­sive and pre-al­lo­cated CPUs or mem­ory. Con­tain­ers can use the cur­rent ma­chine’s ker­nel, but sim­u­late the rest of the OS’s filesys­tem. Es­sen­tially, an Ubuntu Docker con­tainer can run on a Fe­dora sys­tem. From within the con­tainer, it ap­pears as though the sys­tem is run­ning Ubuntu, with its own ver­sions of Python, PHP, or any other apps it needs.

Up­dat­ing a con­tainer does not re­quire you to up­date the sys­tem. An up­dated con­tainer gives you the whole she­bang: the app and its de­pen­den­cies. Con­tain­ers also have their own net­work­ing fa­cil­i­ties and IP ad­dresses on the host sys­tem. This al­lows con­tain­ers to talk to one an­other through ports—like port 8096 for Emby. Docker net­work­ing also al­lows the use of Docker con­tain­ers as train­ing tools.

With all this good­ness, should you run Docker con­tain­ers at home? It de­pends. If you’re try­ing to run mul­ti­ple ser­vices like Sonarr, Plex, and MySQL on one ma­chine, I’d say yes. Many of the con­tain­ers you’ll find on Dock­er­hub have pretty sane de­faults. As it’s pain­less to start, stop, and delete con­tain­ers, it won’t take long to get most things right.

Is there a down­side? You bet. For a start, it’s an­other tech­nol­ogy to learn. Some of the more ad­vanced fea­tures of Docker con­tain­ers can be tricky to use. Get­ting vol­umes, net­works, and other con­figs set up just right can be a pain. And Docker for Linux does not work on the Win­dows Sub­sys­tem for Linux.

On top of this, Docker con­tain­ers aren’t se­cure by de­fault, as they run as root. This can be mit­i­gated by run­ning Docker with user names­paces, but the setup and ad­min­is­tra­tion con­se­quences are non-triv­ial. Re­cently, sev­eral im­ages hosted at Dock­er­hub were re­moved be­cause the im­ages con­tained crypto min­ers and other mal­ware. As a rule, I try to use of­fi­cial con­tainer im­ages or im­ages from www.lin­

The best part about Docker con­tain­ers is that they’re (gen­er­ally) free. Take time to ex­per­i­ment. They aren’t as scary as you might think.

Be­cause it’s pain­less to start, stop, and delete con­tain­ers, it won’t take long to get most things right.

Run­ning a min­i­mal Docker con­tainer im­age is a sim­ple com­mand.

Newspapers in English

Newspapers from Australia

© PressReader. All rights reserved.