Here's how to save and load docker images:
Example scenario: To save a docker image from a docker repository and save it as a tar file locally.
- Save the image as a tarball
docker save repositoryname:tag > repotag.tar
- Zip the image
| First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py | |
| $ cd <download location> | |
| $ sudo -H python ./get-pip.py | |
| Installing pip also installs Python3 | |
| To run Python3 | |
| $ python3 | |
| Install pip3 by just executing the same file as in the step above, but this time using Python3 | |
| $ sudo -H python3 ./get-pip.py |
| # mongo_test_restaurants.py | |
| # Python 2.7.6 | |
| """ | |
| Test script to connect to MongoDB collections using pymongo library | |
| Connects to an already imported connection named "restaurants" | |
| source - https://docs.mongodb.org/getting-started/python/ | |
| """ | |
| from pymongo import MongoClient, ASCENDING, DESCENDING |
| #-*- coding: utf-8 -*- | |
| u""" | |
| MOD: pymongo | |
| """ | |
| import pymongo | |
| #=============================================================================== |
| # -*- coding: utf-8 -*- | |
| import paho.mqtt.client as mqtt | |
| import time | |
| import json | |
| import base64 | |
| def on_connect(client, userdata, flags, rc): | |
| print("Connected with result code " + str(rc)) | |
| dev_eui = 'ZZZZZ' |
| #!/bin/bash | |
| ## | |
| # File: | |
| # nginx_modsite | |
| # Description: | |
| # Provides a basic script to automate enabling and disabling websites found | |
| # in the default configuration directories: | |
| # /etc/nginx/sites-available and /etc/nginx/sites-enabled | |
| # For easy access to this script, copy it into the directory: |
| #!/bin/python | |
| import os | |
| from flask import Flask, Response, request, abort, render_template_string, send_from_directory | |
| import Image | |
| import StringIO | |
| app = Flask(__name__) | |
| WIDTH = 1000 |
Here's how to save and load docker images:
Example scenario: To save a docker image from a docker repository and save it as a tar file locally.
docker save repositoryname:tag > repotag.tar
| #!/usr/bin/env python | |
| import io | |
| import time | |
| import picamera | |
| import picamera.array | |
| import numpy as np | |
| from PIL import Image, ImageDraw |
Headless reinstall and update https://raspberrypi.stackexchange.com/a/57023
In the following, we assume a working Flask application with the name of SCRIPT_NAME. First we need to install a couple of things:
sudo apt-get update && sudo apt-get upgrade
Installing nginx will fail if apache is running. If your installation breaks half ways, then remove the fragments, stop apache (and I actually suggest removing it in case not needed) and then install nginx again:
sudo apt-get remove nginx* --purge
sudo /etc/init.d/apache2 stop