Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
Created August 11, 2017 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglasmiranda/2b5655cfaf0bd89c4133dec300d0d8dd to your computer and use it in GitHub Desktop.
Save douglasmiranda/2b5655cfaf0bd89c4133dec300d0d8dd to your computer and use it in GitHub Desktop.
DietPi on Pine64 and running Docker aarch64

Flash an sd card with the Pine64 DietPi compatible on "Downloads" section. http://dietpi.com/

Configuring

  1. ssh into it: "Ok" and wait for initial update, it will reboot after
  2. It will start on config screen again, so enter DietPi-Config > Advanced Options > Update firmware
  3. Change DietPi-Config > locale, lang, keyboard configs if needed
  4. Go to DietPi-Config > Security Options and change root pass and hostname
  5. You could mark some software to install, switch ssh server and more, but I want a headless / server instalation, so I'll go to "Install" without choosing additional softwares to install, to finish my instalation.

Add my ssh key

mkdir -p ~/.ssh/

echo "MY PUBLIC KEY CONTENTS (~/.ssh/id_rsa.pub)" > ~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys

Install Docker

# Since we don't have an aarch64 package (https://gist.github.com/douglasmiranda/41c582be2e216f09e1c1081a69e66f87)

wget https://github.com/douglas-archives/stuff/blob/master/docker-ce_17.07.0~ce~rc1-0~debian_arm64.deb?raw=true -O docker-ce_17.07.0~ce~rc1-0~debian_arm64.deb

# Dependencies
apt-get install libapparmor1 libltdl7 libseccomp2

dpkg -i docker-ce_17.07.0~ce~rc1-0~debian_arm64.deb
rm docker-ce_17.07.0~ce~rc1-0~debian_arm64.deb

Let's see Docker in action

Just try with some aarch64 image:

docker run -it arm64v8/alpine sh

Docker Compose

You could install Docker Compose any way you like, I'll install like this:

# Installing essential of python2
apt-get install python-minimal

# Python Package Installer
curl https://bootstrap.pypa.io/get-pip.py | python

# Yes, I like to keep everything under control
# pipsi requires this too
pip install virtualenv

# pipsi is a wrapper around virtualenv and pip which installs scripts provided by python packages into separate virtualenvs to shield them from your system and each other
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python
echo "export PATH=/root/.local/bin:\$PATH" >> ~/.bashrc

pipsi install docker-compose

# In case I need to edit inside the Pi
apt-get install -y vim.tiny

Just create a docker-compose.yml with:

version: "2"

services:
  app:
    image: arm64v8/alpine
    volumes:
      - "./:/app"
    command: ["sleep", "99999"]
docker-compose up -d

docker-compose exec app sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment