Skip to content

Instantly share code, notes, and snippets.

@mbrownnycnyc
Last active November 29, 2024 20:26
Show Gist options
  • Save mbrownnycnyc/1c045f17e8235e45469e9d4b02fd784b to your computer and use it in GitHub Desktop.
Save mbrownnycnyc/1c045f17e8235e45469e9d4b02fd784b to your computer and use it in GitHub Desktop.
Using android in docker to router notifications

summary

The purpose of this document is to capture the configuration and setup to run Android on docker on a synology NAS. The purpose of running android is to capture and route notifications via MQTT.

  • this is still not done

precursor

ash-4.4# cat /opt/create_tun.sh
#!/bin/sh

# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
  if ( [ ! -d /dev/net ] ); then
    mkdir -m 755 /dev/net
  fi
  mknod /dev/net/tun c 10 200
  chmod 0755 /dev/net/tun
fi

# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
  insmod /lib/modules/tun.ko
fi

docker compose

  1. create the docker compose file
#vim /volume1/docker/docker-compose-yml/android.yml

version: '3.8'
services:
  android:
    image: budtmo/docker-android:emulator_14.0
    container_name: android_emulator
    ports:
      - "5037:5037" # ADB server
      - "5554:5554" # Emulator console
      - "5555:5555" # ADB device
      - "6080:6080" # VNC
    environment:
      - EMULATOR_DEVICE="Samsung Galaxy S10" # Adjust device if necessary
      - WEB_VNC=true
      - APPIUM=false # Disable Appium if not needed
      - AUTO_RECORD=false
    volumes:
      - /volume1/docker/android/androidusr:/home/androidusr
    restart: unless-stopped
    networks:
      vlan10:
        ipv4_address: 192.168.10.90
    dns:
      - 192.168.1.1

networks:
    vlan10:
        external: true

11.2. download the image and run the image

#as root
mkdir -p /volume1/docker/android/androidusr
#note the user of the same UID and GID that was identified earlier
chown 1026:100 -R /volume1/docker/android/androidusr
export DOCKER_CLIENT_TIMEOUT=120
export COMPOSE_HTTP_TIMEOUT=120
COMPOSE_HTTP_TIMEOUT=480
docker compose -f /volume1/docker/docker-compose-yml/android.yml up -d

11.3. verify that the container is running

#once it's running, review logs
docker logs -f sabnzbd
#to tshoot bash is available
docker exec -it sabnzbd /bin/bash

### verify that you are accessing the internet via the PIA tunnel
curl ipinfo.io
#or use this https://github.com/transilluminate/check-pia-vpn/blob/main/check-pia-vpn.sh
echo -n "are you NOT using PIA (are you exposed)? "; curl --silent -X POST -H "Content-Type: application/json" -d '{"ipAddress": '`curl --silent https://www.privateinternetaccess.com/site-api/get-location-info | jq .ip`'}' https://www.privateinternetaccess.com/site-api/exposed-check | jq .status

11.4. configure sabnzbd

  1. access http://192.168.20.70:8080 and set language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment