Loki not working with grafana

I can get loki and promtail to launch. But they are refusing to communicate with grafana.
Im using Portainer for docker management. i get this error in grafana when i try to connect to it.

Unable to connect with Loki. Please check the server logs for more details.

If i go to the IpAdress:3100 i get a 404 error but going to IpAdress:3100/metrics i get metrics. so its doing something but
i have grafana running in a seperite container and is connected to bridge network
this is the loki promtail stack

version: "3"
networks:
  loki:
services:
  loki:
    image: grafana/loki:2.4.0
    user: 568:568
    environment:                                 
      - PUID=568                                 
      - PGID=568
    volumes:
      - /mnt/apps pool/apps/loki/loki:/etc/loki
    ports:
      - "3100:3100"
    restart: unless-stopped
    command: -config.file=/etc/loki/loki-config.yml
    networks: # i have tryed changing this to host and bridge and even removing this with no change
      - loki
  promtail:
    image: grafana/promtail:2.4.0
    user: 0:0
    environment:                                 
      - PUID=568                                 
      - PGID=568 
    volumes:
      - /var/log:/var/log
      - /mnt/apps pool/apps/loki/promtail:/etc/promtail
    ports:
     - "1514:1514"
    restart: unless-stopped
    command: -config.file=/etc/promtail/promtail-config.yml
    networks: # i have tryed changing this to host, bridge and even removing this with no change
      - loki

This is the loki config.yml

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  path_prefix: /tmp/loki
  storage:
    filesystem:
      chunks_directory: /tmp/loki/chunks
      rules_directory: /tmp/loki/rules
  replication_factor: 1
  ring:
    instance_addr: 127.0.0.1
    kvstore:
      store: inmemory

schema_config:
  configs:
    - from: 2020-10-24
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h

ruler:
  alertmanager_url: http://localhost:9093

and this is the promtail config.yml

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://loki:3100/loki/api/v1/push

scrape_configs:

# local machine logs

- job_name: local
  static_configs:
  - targets:
      - localhost
    labels:
      job: varlogs
      __path__: /var/log/*log
  
## docker logs

#- job_name: docker 
#  pipeline_stages:
#    - docker: {}
#  static_configs:
#    - labels:
#        job: docker
#        __path__: /var/lib/docker/containers/*/*-json.log

# syslog target

#- job_name: syslog
#  syslog:
#    listen_address: 0.0.0.0:1514 # make sure you also expose this port on the container
#    idle_timeout: 60s
#    label_structured_data: yes
#    labels:
#      job: "syslog"
#  relabel_configs:
#    - source_labels: ['__syslog_message_hostname']
#      target_label: 'host'```

ok i figured this out after following a different guide i got it working