I have a superset container running with a postgreSQLdatabase.All is working fine. I can see my table and making queries from superset SQL Lab.
- I also added dataset, createdchartanddashboard.
However when I stop my containers and restart them, I lost all datasets, charts and dashboard. I even lost the database connection I made before (URI method)
Is something wrong with my docker-compose file? How can I avoid this?
version: '3.9'
services:
  superset:
    build:
      context: ./superset
      dockerfile: dockerfile
      extra_hosts:
        - "edge.tdp:141.94.172.122"
    container_name: superset
    environment:
      - ADMIN_USERNAME=admin
      - [email protected]
      - ADMIN_PASSWORD=admin
    ports:
      - '8088:8088'
    volumes:
      - .:/app/tdp
    
  db:
    container_name: postgresql
    image: postgres:15
    restart: unless-stopped
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    volumes:
      - ./db-data:/var/lib/postgresql/data
  
 
                        
You also need to pass your database info to the Superset container to use your Postgres instance as backend database.
This should get you going:
This is the relevant config file that reads those environment variables:
superset_conig.pyUltimately, depends on the custom Dockerfile you use which you didn't provide.
Edit: See how Apache Superset build their
docker-compose.yml