Hello,
I’m new to Docker and need some help with a pre-compiled Docker image installation in combination with the OverlayFS file system. The associated docker service periodically writes data to a file, that will be also used at startup. I need persistent storage for this file, but don’t know how to achieve it?
Here are the details of my OpenSprinkler Weather Server Docker installation:
OpenSprinkler is a Garden Watering System that may be controlled by weather data. The weather data is thereby handled by a Weather Server, which also allows for a local Raspberry PI installation. As I’m already running WeeWX as a weather source on a Raspberry Pi 3, it might be helpful to run the Weather Service Version 3.0.2 on the same Raspberry PI in a Docker Installation. I’m using Debian GNU/Linux 12 (bookworm) and Docker Version 29.1.3.
There is a precompiled OpenSprinkler-Weather Server available at GitHub. The GitHub repository automatically publishes an up-to-date image, which I pulled as follows:
pi@raspberrypi:~ $ docker pull Package weather-server · GitHub
Thereafter, I created the /weather directory and created the following compose.yaml file.
services:
weatherserver:
image: Package weather-server · GitHub
container_name: WeatherServer
restart: unless-stopped
environment:
HOST: 0.0.0.0
PORT: 3000
GEOCODER: GoogleMaps
GOOGLE_MAPS_API_KEY: XXXXXXX
WEATHER_PROVIDER: local
PWS: WU
LOCAL_PERSISTENCE: true
TZ: Europe/Vienna
ports:
- 3000:3000
working_dir: /weather
However, I omitted any “volumes definition”, for reason that I don’t know how to define it?
I started the WeatherServer with Docker Compose:
pi@raspberrypi:/weather $ docker compose up
[+] up 2/2
Network weather_default Created 0.3s
Container WeatherServer Created 0.5s
Attaching to WeatherServer
WeatherServer |
WeatherServer | > os-weather-service@3.0.2 start
WeatherServer | > node dist/index.cjs
WeatherServer |
WeatherServer | OpenSprinkler Weather Service now listening on 0.0.0.0:3000
WeatherServer | OpenSprinkler Weather Service now listening for local weather stream
WeatherServer | Loaded baseline ETo data.
It works as expected and is still waiting to get sufficient weather data, which takes at least 24 hours to complete.
OpenSprinkler Weather Service v3.0.2
&errCode=10&scale=100
The WeatherServer creates and periodically writes the retrieved weather data to an observations.json file. New weather measurements are added every 30 minutes to this file. The file is stored within the OverlayFS file system. It can be copied, e.g. to the /weather working directory with:
sudo docker cp WeatherServer:./weather/observations.json /weather/observations.json
The question is now, what “volumes definition” is valid for my setup? I would like to have the observations.json file permanently in place, to store the weather observations and survive docker restarts and updates. Sorry for the long explanation. I have read through all the tutorials and searched the web about this problem. But, I have no ideas yet how to so solve it?
Thanks in advance.
Franz