I just started with Docker on my Synology NAS and quickly realized the value of Docker. After lot of failed attempts, I was finally able to setup MySQL in a Docker container on my NAS (thanks to @gbboy). Here are the steps that I followed (I am sure these steps should work on other hardware, but YMMV):
- SSH into Synology NAS and pull the image using
docker pull sameersbn/mysql:latest
. After you login asadmin
, you may have to runsudo su
if you keep getting permission errors. - Make sure that the folder
/volume1/docker/mysql/data
exists (create one, if it does not). - I am using sameersbn/mysql image. Run, the command and make sure that the container is up and running.
docker run --net=host --restart=always --name mysql -d -v /volume1/docker/mysql/data:/var/lib/mysql -e 'DB_USER=hass' -e 'DB_PASS=12345' -e 'DB_NAME=homeassistant' sameersbn/mysql:latest
- Add the following to the config (where 192.168.2.113 is the IP address of my NAS):
recorder:
db_url: mysql://hass:[email protected]/homeassistant?charset=utf8
- Restart Home Assistant and profit
I have some useful mysql commands in my HA cheatsheet that you may find useful.