How to locate Teslalogger backups when running Teslalogger in a Docker Container, and copy those to a safe location

Mathias Wagner
2 min readJan 9, 2021

Intro

Tesla cars can be queried via a documented API. This is a quite unique feature, allowing drivers of these cars to gain detailed insights. Available data points are e.g. consumption, speed, battery status or charging activities. There are a couple of self-hosted tools available to collect these treasures and analyze it.

Teslalogger (mostly build by Christian Pogea) is one of them and available on Github. There you can also find most of the existing documentation as well as links to the Raspberry Pi images. I decided to host it on my own, running in Docker containers on my QNAP NAS.

There is a short readme on how to fire it up in a Docker environment. Teslalogger creates daily backups on its own, which is great. But these are stored on the same disk as the containers. So if you want them to survive a host HD crash, an encryption malware or worse, you better copy them to a save location(s).

Locate the Teslalogger backup files

  1. You can copy files from a running container, like this
    docker cp a4d5:etc/teslalogger/backup /teslaloggerBackup
    a4d5
    is the beginning of my container ID for teslalogger_teslalogger_1, but the container ID changes after a restart. The container name might also change in the future. Luckily there is an easier solution:
  2. Locate the Teslalogger backup path in your host’s file system. Then there is no need to extract the backup files from the container.
  3. The local file system mapped into the container is exactly the same as the location in your file system used for building the container images (as of Teslalogger version 1.45.17.0).
  4. For me this would be on a QNAP device:
    /share/CACHEDEV1_DATA/homes/USERNAME/TeslaLoggerSetup/TeslaLogger/TeslaLogger/bin/backup
  5. If you don’t know the path, you can find it out via
    docker container inspect a4d5 | grep "etc/teslalogger"
    Alternatively you can use docker container inspect teslalogger_teslalogger_1 | grep "etc/teslalogger"
    assuming, the container name is unique across future versions
  6. Now that we have the backup files’ location, we can store those away using a method of choice, like rsync to a local SMB or encrypt it and copy to a cloud storage. Here’s my tutorial on how you can backup encrypted files from a QNAP NAS to Google Drive. As the files are located in my NAS’ user folder, they are already safe :D.
    QNAP users: don't get confused by CACHEDEV1_DATA. I don't know why they introduced this alias, but
    /share/CACHEDEV1_DATA/homes/USERNAME/randomFolder is pointing to
    /share/CACHEDEV1_DATA/homes/USERNAME/randomFolder or the other way round ;).

--

--