DOCKING FOR BEGINNERS
Let’s start by installing Docker on Ubuntu. While it’s possible to install through a command-line package manager, setting up the requisite repositories is a little long-winded. Instead, head to download.docker.com/ linux/ubuntu/dists and grab the latest stable version for your system — you’ll find a .deb package within the requisite /pool/ folder. Download it, rather than open it in Ubuntu’s software installer.
Open a Terminal window, and head to the directory where you downloaded the package (typically ~/Downloads). Type sudo dpkg -i docker then, before hitting Return, hit Tab to complete the name of the package you just downloaded. Hit Return, and the installation should happen.
Let’s check that it did. Fire up the Docker daemon with sudo systemctl start docker , then run sudo docker run helloworld . All being well, this pulls in a sample script and executes it — if you see a cheery message, you’re good to go.
Time to install something that does more than just display a message. Run sudo docker pull nextcloud to grab a container encapsulating everything required to run a NextCloud file server. At 700MB, it’s fairly large, but bear in mind the NextCloud app is 100MB, plus we’ve got Apache, PHP 7 and a bunch of extensions, along with the SQLite database packaged in with it, all ready to go.
Run the container with sudo docker run -d -name maxcloud -p 8080:80 nextcloud . The ‘-d’ option tells Docker to run in the background (detached), and the ‘-p’ part forwards port 80 on the container to port 8080 on our host. The ‘-name’ part is optional; a random one is assigned if you don’t specify one here.
Assuming that command didn’t give you any error messages, fire up your web browser, and browse to http://localhost:8080. Behold! A fully functioning NextCloud installation — no messing with Apache configuration files or directory permissions, it just works.
All you need to do is enter some admin credentials and click ‘Finish Setup’. When you stop the container with sudo docker stop maxcloud , any changes are saved, unless the underlying image is upgraded, so you can resume it as it was with sudo docker start maxcloud in future.