Docker commands through Docker Context often fail randomly

I use Docker Context to deploy Docker containers in my Synology NAS. Every time I try to do a docker-compose up - I get some errors like this:

unable to get image '<any-image>': error during connect: Get "http://docker.example.com/v1.41/images/linuxserver/jellyfin:10.10.3/json": command [ssh -o ConnectTimeout=30 -T -- nas-local docker system dial-stdio] has exited with exit status 255, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=Connection closed by 192.168.0.6 port 22

This even happens when I stop the containers or do docker-compose down.

The very weird thing is that this happens randomly. If I try enough times, it will eventually work normally. Any idea of why this happens?

  1. Synology Docker Engine: v20.10.23
  2. Host Docker Engine: v27.3.1

EDIT:

Another different error while doing compose down. It managed to turn off all containers but two of them:

error during connect: Post "http://docker.example.com/v1.41/containers/20d735f5b3e4eea7076ce81bbdcdbde8d70636dcec2abbea2dab4da92c541605/stop": command [ssh -o ConnectTimeout=30 -T -- nas-local docker system dial-stdio] has exited with exit status 255, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=kex_exchange_identification: read: Connection reset by peer

Connection reset by 192.168.0.6 port 22