Skip to content

数据库

MySQL

使用 Docker 命令启动 MySQL ,更多操作查看 MySQL,DockerHub。

yaml
version: '3'

services:
  mysql:
    image: mysql:8
    container_name: mysql
    restart: always
    ports:
      - 3306:3306
    volumes:
      - mysql-data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
volumes:
  mysql-data:
    driver: local

Access denied

sh
docker-compose rm -v

MongoDB

mongo

yaml
version: '3'

services:
  mongo:
    image: mongo:5.0.16
    container_name: mongo
    restart: always
    ports:
      - '27017:27017'
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example
    volumes:
      - mongo-data:/data/db
volumes:
  mongo-data:
    driver: local
yaml
version: '3.9'

services:

  teable-db:
    image: postgres:15.4
    restart: always
    ports:
      - '42345:5432'
    volumes:
      - teable-db:/var/lib/postgresql/data:rw
      # you may use a bind-mounted host directory instead,
      # so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/postgresql/data:rw
    environment:
      - TZ=${TIMEZONE}
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    networks:
      - teable-standalone
    healthcheck:
      test: [CMD-SHELL, 'sh -c ''pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}''']
      interval: 10s
      timeout: 3s
      retries: 3
yaml
version: '3.8'

services:
  db:
    restart: always
    image: postgres:14-alpine
    user: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 1225postgres
      POSTGRES_DB: running
    volumes:
      - pg-data:/var/lib/postgres/main-data
    healthcheck:
      test: [CMD-SHELL, pg_isready]
      interval: 10s
      timeout: 5s
      retries: 5
    ports:
      - 5433:5432

volumes:
  pg-data:
    driver: local