This Worked for me finally:
For docker I exec’d bash into the plex container and ran the command there