It’s running inside the dovecot container. It uses ‘imapsync’ to sync the IMAP account, you could try to run the command manually inside the container:
/usr/local/bin/imapsync --tmpdir /tmp --nofoldersizes --addheader --exclude (?i)spam|(?i)junk --delete2duplicates --subscribeall --automap --ssl1 --host1 imap.gmx.net --user1 YOUR.USER@gmx.de --passfile1 /tmp/imapsync.V0dvCLT --port1 993 --host2 localhost --user2 YOUR.USER@MAILCOW.DOMAIN*SOME_ID_I_DONT_KNOW_HOW_ITS_CONSTRUCTED@mailcow.local --passfile2 /tmp/imapsync.Sai1UBI --no-modulesversion --noreleasecheck
About –user2: there’s an ID added (SOME_ID_I_DONT_KNOW_HOW_ITS_CONSTRUCTED), no idea where that’s coming from. Maybe you can try to guess it from your working sync job.
I guess thee passwords of both accounts have to be in plain text inside the passfiles. As I said, you can try that 🙂