Don't forget to...


Tuesday, June 6, 2017


blah blah




Saturday, December 31, 2016

Docker on RPi

Here are a few important commands I've learned about docker so far.  I've been working on getting Docker running on RPi which now has support for it.  It's a little different on RPi because RPi boards use the ARM architecture rather than the intel architecture, which most all other CPUs use.  That means that although Docker containers are supposed to be able to run on any machine with Docker installed, it's not true in the case where the container was built on intel and run on ARM or vice versa.  So you have to look for the right types of images to build on top of.  Anything on that includes 'rpi' or 'arm' should usually be able to run on the RPi.  For example:

Docker run
Docker start
Docker stop
Docker ps

-t tag
--name name of image

-d run container as daemon in background

list running containers:
# docker ps

list all containers:
# docker ps -a

list all images:
# docker images

stop and remove all docker containers:
# docker stop $(docker ps -a -q)
# docker rm $(docker ps -a -q)

stop and remove all docker images:
docker rmi $(docker images -q)

each container has a main process, and will die when that process ends.  But you can run loads of containers at the same time.

backup a mysql db called 'wordpress' which is on the localhost:
mysqldump --add-drop-table -h -u dbocodex -p wp > blog.bak.sql

add current user to www-data group:
sudo gpasswd -a ${USER} www-data

run with privil'd access to memory (for GPIO stuff)
docker run --privileged ....

run shell within container:
docker exec -it bash

package caching break apt-get installs, fix by :

commit changes in a container to an image:
docker commit

backup mysql db to .sql file:
mysqldump -u -p >

restore mysql db from .sql file:
> echo "CREATE DATABASE ;" | mysql
> mysql -u -p <

remove sensitive data(a file and it's history) from a git commit:

Resetting Wordpress password :
through DB: "Through MySQL/MariaDB Command Line"

copy file from container to host:
docker cp :/path/to/file path/to/copy/to

Wednesday, December 28, 2016

WordPress on RPi

I got it working on the RPi - this one didn't take too long because there weren't too many hiccups.

Step1: - start at section 4, as the previous blog posts here have outlined how to do the previous steps already.  One thing you'll need is to remember the password you created for MySQL - the username is 'root'.

Tuesday, December 27, 2016

Passwordless SSH access to the RPi

Got it working, and added some security changes.

Step 1: see about generating ssh keys if you haven't already got them present in ~/.ssh (make sure you've used ssh-add and make sure the value for AuthorizedKeysFile in /etc/ssh/sshd_config is set to '%h/.ssh/authorized_keys')

Step 2: use excluding the key gen section to get passwordless ssh working, turn off passwords, and get port forwarding working.  Remember, to update settings on the router, go to - but only from the 1 of the 2 approved devices that you set.

Step 3: test the ability to login from a remote ssh client : 'ssh -p'

Web Server with RPi 3

Got a web server running a raspberry pi 3 today!

Step 1: Start up the pi and install raspbian

Step 2: (follow everything until the stuff about no-ip - then things were different because I'm using google domains)

Step 2.5: (found this out later) Make sure to add a permanent lease for the internal IP address that the RPi has - do this using your router settings.  If you don't, then your router might unexpectedly change your RPi's IP and you'll have to figure out what it is again, and change the port forwarding as well.

Step 3: add 2 entries to the Dynamic DNS section of your google domains page - 1st one is '@', 2nd is 'www'.

Step 4: go on the RPi and install ddclient (sudo apt-get install ddclient) - when the install prompts come up, use the username and password from either of the new DDNS entries in google domains (expand it).  Use wlan0 (unless you're on ethernet now).  I think the rest should be easy to choose in setup.

Step 5: (install vim), and then 'sudo vim /etc/ddclient.conf'
use the following to set it up, so that both '' and '' work:


password='yourpass' # don't forget the single quotes

password='yourpass2' # don't forget the single quotes

Step 6: save and go to command line and run:
sudo service ddclient restart
sudo service ddclient start
sudo ddclient -daemon=0 -debug -verbose -noquiet

The last command might take a few minutes - be patient, no more than 5.  Some lines in the output should tell you for each of the 2 domains if the DNS entries were updated.  If you see that they were then you're done, otherwise troubleshooting begins.  This site might help, it showed me how to get the proper ddclient.conf with 2 domains :

Have fun!