Can I migrate from binary to docker?

Environment variables always overrule values in the config.json and at the bottom of your .env file, you will see some of them (like MM_SERVICESETTINGS_SITEURL, MM_SQLSETTINGS_DRIVERNAME, etc.).
You either need to make sure that they contain the correct values, or you remove them from the environment: section in your docker-compose.yml.

    environment:
      # timezone inside container
      - TZ

      # necessary Mattermost options/variables (see env.example)
      - MM_SQLSETTINGS_DRIVERNAME
      - MM_SQLSETTINGS_DATASOURCE

      # necessary for bleve
      - MM_BLEVESETTINGS_INDEXDIR

      # additional settings
      - MM_SERVICESETTINGS_SITEURL

The message you’re seeing here might be related to the fact that your docker-compose version is too old to handle variable substitution in the .env file, but if you do not want to use the environment variables here, you do not need to worry about that and just get rid of them.