Maximum PC - UK (2019-09)

(Antfer) #1
Build a Better Home

Server With Docker

1


PICK A PLATFORM
You’re probably running Windows on your main PC, but
while Docker is available for Windows machines, using it on
Windows is not worth the effort. It sits much more comfortably
on Linux, and as you’re going to dig up some old hardware and
run a dedicated machine for your containers, that’s the way to
go. Your first step, then, is to get that hardware (or a virtual
machine, if you’re just looking to test things out) running Linux.
We used the desktop spin of Lubuntu 19.04—download it from
http://lubuntu.net [Image A], write it to a USB stick with Rufus
(http://rufus.ie), boot up your machine, and install it, ensuring
you use a ver y strong password if you’re likely to open the ser ver
up to the Internet in the future. You can run Docker just fine on a
Raspberry Pi, but the power available to its individual containers
may not be adequate to tease strong performance out of them.

2


SET THE CONNECTION
It’s obviously a good idea to set up headless access to your
server, so you can administer it from your main PC, and do
away with the monitor and keyboard. Open up a terminal window,
and run sudo apt update followed by sudo apt install openssh-
server to install a decent SSH server; run sudo systemctl status
ssh when you’re done to check it’s running. It’s also handy to
have a fixed IP address, so your server doesn’t go walkabout if
you reboot: While still at the desktop, you can set this by heading

EVERY GOOD HOME NEEDS A SERVER. It doesn’t really matter what you intend to use it for.
Whether you’re throwing media around, performing backups, running game servers, or doing
any other nebulous serving work, a dedicated machine is the best way to go about it—it leaves
your main box free to work its hardest, and means those services are available whenever you
need them. But the worst thing about a server is when it isn’t there any more. If one of your
software components forces a reboot, crashes the machine completely, or if it decides it likes
system resources so much that it would like to take them all, everything else falls to bits along
with it. Unless, that is, you manage your server properly.
Predictably, this brings us to Docker. Essentially, it’s a way to compartmentalize everything
on your server—each Docker container you run sits in its own sandboxed space, only reaching
out as far as you let it, which means that while Docker containers can interact with each other,
they’re also able to be completely insulated. They’re like little servers in their own right: If
something goes wrong, just reboot the container. And it’s so simple to get started.... –ALEX COX

YOU’LL NEED THIS


SERVER HARDWARE
Use whatever spare silicon
works for you.

LUBUNTU
Grab it from http://lubuntu.net.

DOCKER COMMUNITY
EDITION
You can find out more at
http://www.docker.com.
to the network manager via the icon in the top-right of the
screen, selecting wired or wireless settings (depending
on your connection), clicking the gear icon, and filling in
the appropriate boxes. Reboot your server machine, and
you should be ready to go.

3


HOOK YOURSELF UP
Frustratingly, the best SSH tool for Windows still
seems to be the aging PuTTY (http://putty.org),
though if you’re cunning, you could also run the distro of
your choice over the top of Microsoft’s Linux Subsystem
for Windows and access SSH from the command line.
Head to your main PC, fire up PuTTY, and connect to the
IP address you set earlier. On your first connect, select
“Yes” to add the host key to PuTTY’s cache, and log in
with the username and password you set earlier.

4


DOING DOCKER
Next, install Docker, which, due to our awkward
choice of OS, means grabbing an older version.
Start by adding the Docker GPG key to your server with
curl -fsSL https://download.docker.com/linux/ubuntu/
gpg | sudo apt-key add - then add the Docker repository,
so your server knows where to find the files, with sudo
add-apt-repository “deb [arch=amd64] https://download.
docker.com/linux/ubuntu cosmic stable edge”. Once

B

A

©^

LU

BU

NT

U

54 MAXIMUMPC SEP 2019 maximumpc.com


R&D

Free download pdf