PiWare

What is Docker?
Docker is a tool for easily setting up containerised software, which takes away a lot of the setup process and makes it easy to add and remove software without much hastle. The guide will be taking you through installing Docker on the Raspberry Pi, and showing some examples of the things you can install.

Steps to install
  1. First you should update all the software on the Pi to make sure everything is up to date. You can do this by running the following in the SSH terminal you set up on the last page:

    # sudo apt-get update && sudo apt-get upgrade

  2. Now we will need to download the install script. We can do this by running the following command:

    # curl -fsSL https://get.docker.com -o get-docker.sh

  3. Next we will need to run this script to install Docker on the the Pi. Run the command:

    # sudo sh get-docker.sh

Docker should now be successfully installed, but there are a couple of things we should do before we start to install anything.
  1. Currently Docker is only available to the root user, meaning we have to run sudo everytime we would like to use it. We can allow the non-root user to use Docker by running:

    # sudo usermod -aG docker [username]

    which if you used the default pi username should be:

    # sudo usermod -aG docker pi

  2. To now test out our new Docker install, run the following command:

    docker run hello-world

You are now done
We should now be completed our installation. If this is all you needed to do, you may now go and do as you wish with your new Docker installation. You can find applictions to install with docker at the Docker Hub. If you would like to stick around for some examples of what you can do with Docker, well you’re in luck.

Running a Minecraft Java Edition Server
Setting this up is incredibly easy thanks to Docker. There is only 1 command you have to type to get it installed.

# docker run -d -p 25565:25565 --name mc itzg/minecraft-server

That is all you need to type to get your Minecraft server installed and running. To connect, you should be able to type raspberrypi.local into the Direct Connect menu and join. Currently it is only available to your local network, but if you are interested in making this server accessible to the rest of the internet, you may look in to port forwarding your server.

Running a Nextcloud instance
This is as simple as the last setup. All you need to do to get it running is type in:

docker run -d -p 8080:80 nextcloud

That's it, it is now running. To access it, type raspberrypi.local:8080 in to your browser and it should connect and show you the page.