We’re just about ready to start installing apps using Co-op Cloud. Co-op Cloud apps are a set of Docker containers. We’ll sometimes work with docker directly, so let’s go over the concepts involved.
There’s some background info below, but if you’re already familiar with Docker and Docker Swarm, you can skip ahead to Installing Docker.
Installing Docker
The following instructions are all related to your account on the Raspberry Pi, so start by logging in with SSH (ssh lores.local).
Install docker packages
There are a few different ways to install Docker on Ubuntu. We’re going to use the convenience script here, the same as in the co-op cloud instructions (above). This is obviously a security trade-off, we’re trusting that docker doesn’t sneak other commands into this publicly viewable but somewhat complex script. However, we’re going to run code from Docker with root privileges anyway. If you’d prefer to use the more manual approach instead, follow these instructions.
So, ssh into the Pi (ssh lores.local) and then run:
curl https://get.docker.com | bash
Using docker without sudo
With that done, let’s ensure the that your user on the PI can run docker commands without needing to use sudo. We’ll do this by adding your user to the docker group. You can see which groups you’re a member of currently by running groups.
To add yourself to the docker group, run:
sudo usermod -aG docker $USER
For this to take effect, you’ll need to log out then in again. Type exit to log out, then ssh lores.node to log back in.
To prove out docker setup is working, let’s run a hello-world container.
docker run hello-world
You should get a nice message saying everything is working.
Starting a docker swarm
We want to start a docker swarm. A swarm can be more than one computer, and so we could add others to it later. At the moment though, we only need a swarm containing our one Raspberry Pi. To start a swarm, run:
docker swarm init
You’ll be given a join token for other computers to join, but you can ignore that for now, it can be retrieved again if needed.
Creating the Co-op Cloud docker network
You’ll need to go ahead and create a docker network to support Co-op cloud apps. Run: