how do i reference self signed ssl certificates for traefik v2 in docker-compose file

There is very limited documentation for referencing self signed certificates for traefik v2 in the docker-compose yaml file here is how you can do it for letsencrypt

https://github.com/containous/blog-posts/blob/master/2019_09_10-101_docker/docker-compose-07.yml#L11-L14

version: "3.3"

services:
  traefik:
    image: "traefik:v2.0.0"
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.docker
      - --api
      - --certificatesresolvers.leresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
      - [email protected]
      - --certificatesresolvers.leresolver.acme.storage=/acme.json
      - --certificatesresolvers.leresolver.acme.tlschallenge=true

but i tried to check documentation and i have not seen any way to reference self signed certificate in the docker-compose file without having a toml file

I have tried this

version: "3.3"

services:
  traefik:
    image: "traefik:v2.0.0"
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.docker
      - --api
      - --providers.docker.tls.cert=/etc/certs/server.crt
      - --providers.docker.tls.key=/etc/certs/server.key

but got the following error

Failed to retrieve information of the docker client and server host:
error during connect: Get
https://%2Fvar%2Frun%2Fdocker.sock/v1.24/version: http: server gave
HTTP response to HTTPS client” providerName=docker

here are resources i have used that do not provide any way to setup self signed certificates to enable htttps for traefik v2 in the docker-compose yaml file

https://docs.traefik.io/reference/static-configuration/cli/
https://docs.traefik.io/https/tls/#user-defined

i do see this on this page https://docs.traefik.io/https/tls/#user-defined

tls:
  certificates:
    - certFile: /path/to/domain.cert
      keyFile: /path/to/domain.key

but it is for file yaml config file and i need to convert this to the docker-compose yaml file equivalent as it is above how they have done for letsencrypt

Source: StackOverflow