How can I create a volume for the current user home directory in docker-compose?

~/.docker/config.json should work for this

version: "3"
services:
  watchtower:
    image: v2tec/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ~/.docker/config.json:/config.json

~ wasn't working for us, it was creating folder called something.json, we fixed it like this:

volumes:
  - /var/run/docker.sock:/var/run/docker.sock
  - ${HOME}/.docker/config.json:/config.json