I'm having this issue on both a Pi 3B and a Pi 4 4GB model. I'm running some programs I wrote that run with
docker-compose, and most days, if not every day, around the same times I suddenly won't be able to connect to them from the local network.
From my computer I'll not be able to ping/ssh them or load any web servers they host (even the non-docker ones). When I connect a monitor I can see they're still running but are having DNS resolution issues so it can't connect to anything. They also still show up on my router's connected devices list. I tried using Cloudflare's 184.108.40.206 on the 3B but the issue still came back the next day.
Additionally, the first time it happened on the Pi 4, I could connect to a web server hosted on it that's port forwarded using my external IP, but not the local IP, and it wouldn't respond to ssh. Was really strange, restarting the Pi fixed it.
This only started happening since I started using docker. Both of them had been running totally fine for a long time, then I dockerized something I was running on the Pi 3B and it started having this issue soon after. Then I made a new project a few days later and hosted it on the Pi 4 and then it started having this issue as well. Both of them are connected via ethernet. I have a Pi 3B+ that is also running the same thing as the Pi 3B (a python script in docker-compose that records things with the pi camera module) though it uses wifi and has not had this issue. Restarting the Pi would fix it, but I don't want to have to power cycle them every day. The only other difference besides wifi vs ethernet is the Pi 3B+ that isn't having issues recently had Raspberry Pi OS re-installed but the others have been running the same installation since the Pi 4 was released.
All of them are using static IPs that are outside the router's DHCP address pool range so I know it's not an IP address conflict with another device. I tried disabling ipv6 and that didn't help.
They're all running Raspberry Pi OS and should be pretty up to date. I installed docker using the convenience script they say to use for Raspberry Pis, and installed docker-compose with
This is my docker setup running on the Pi 4.
version: '3.7' services: app: build: context: . target: prod depends_on: - postgres restart: always ports: - 4042:3000 postgres: image: postgres:13-alpine environment: POSTGRES_USER: $PGUSER POSTGRES_PASSWORD: $PGPASSWORD POSTGRES_DB: $PGDATABASE volumes: - type: volume source: postgres target: /var/lib/postgresql/data volume: nocopy: true - type: bind source: ./config/postgres target: /docker-entrypoint-initdb.d/ restart: always volumes: postgres:
FROM node:12 AS dev WORKDIR /usr/src/app COPY package*.json ./ RUN npm install CMD ["npx", "nodemon", "konshuu-server.js"] FROM dev AS prod COPY . . RUN npm run build CMD ["node", "konshuu-server.js"]