Docker Community Forums

Share and learn in the Docker community.

MacOS Unable to init server error when SSH'ing to Raspberry Pi

(Joesan) #1

I have a project where I have created a Docker container for OpenCV and another Docker container for my Python codebase which can do motion detection on my Raspberry Pi installed with the Pi camera module.

I’m connecting to my Raspberry Pi remotely via SSH from my Mac. I then try to run the respective Docker container to start my Python script. Here is the command:

  docker run -ti --device=/dev/vcsm \
    --device=/dev/vchiq \
    -v /tmp/.X11-unix:/tmp/.X11-unix:ro \

I have some debug print statements in my Python script that prints out some INFO statements, but then I hit an error as shown below:

[SUCCESS] dropbox account linked
[INFO] warming up...
[INFO] starting background model...
[INFO] calculated frame delta
Unable to init server: Could not connect: Connection refused

(Security Feed:17): Gtk-WARNING **: cannot open display: .0

I have also specified ssh -Y when ssh’ing to the Pi, but it did not help!

I have High Sierra 10.13.3 installed on my Mac and an echo for the DISPLAY would yield the following:


I’m using Raspbian Stretch Lite version on my Raspberry Pi. How could I get this resolved? Any suggestions?