I was struggling with permission with ftp and our WordPress volume inside docker. Even with using user and group id 33, we wouldn't have write permission in some folders. The root cause in our case was we had set up our WordPress from an Updraft plus backup. The files restored were not restored by user 33.
I ran the following command to have full permission with a compose.yml
similar to the one @jccampanero posted.
docker exec -it container_name sh
chown -R 33:33 /var/ww/html