## 示例
version: "3.9" services: db: image: mysql # restart: always container_name: nocodb-db # ports: # - 3307:3306 # command: # #这行代码解决无法访问的问题 # --default-authentication-plugin=mysql_native_password volumes: - nocodb-db:/var/lib/mysql # - d:/code/docker_project/mysqlData/data/:/var/lib/mysql/ # - d:/code/docker_project/mysqlData/conf/:/etc/mysql/conf.d/ # - d:/code/docker_project/mysqlData/init/:/docker-entrypoint-initdb.d/ # 数据库还原目录 可将需要还原的sql文件放在这里 # - d:/code/docker_project/mysqlData/mysql/source:/docker-entrypoint-initdb.d environment: - MYSQL_RANDOM_ROOT_PASSWORD=yes - MYSQL_DATABASE=nocodb - MYSQL_USER=nocodb - MYSQL_PASSWORD=password - TZ=Asia/Shanghai healthcheck: test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] timeout: 20s retries: 10 nocodb: depends_on: db: condition: service_healthy image: nocodb/nocodb:latest container_name: nocodb restart: always volumes: - d:/code/docker_project/nocodb/data:/usr/app/data/ ports: - 8080:8080 environment: - NC_DB=mysql2://db:3306?u=nocodb&p=password&d=nocodb volumes: nocodb-db:
参考文章
[NocoDB a Open Source Airtable Alternative - General Discussion - MIT App Inventor Community](https://community.appinventor.mit.edu/t/nocodb-a-open-source-airtable-alternative/34119/10)
主要参考代码块
version: '2' services: db: image: mysql:5.7 container_name: nocodb-db volumes: - nocodb-db:/var/lib/mysql environment: - MYSQL_RANDOM_ROOT_PASSWORD=yes - MYSQL_DATABASE=nocodb - MYSQL_USER=nocodb - MYSQL_PASSWORD=password healthcheck: test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] timeout: 20s retries: 10 nocodb: depends_on: db: condition: service_healthy image: nocodb/nocodb:latest container_name: nocodb environment: - NC_DB=mysql2://db:3306?u=nocodb&p=password&d=nocodb - NC_PUBLIC_URL=https://noco.example.com volumes: nocodb-db:
其他参考
[docker_compose_nocodb/docker-compose.yml at main · olegrand1976/docker_compose_nocodb · GitHub](https://github.com/olegrand1976/docker_compose_nocodb/blob/main/docker-compose.yml)
version: '3.6' services: root_db: image: mysql:8.0.27 ports: - "3306:3306" - "33060:33060" volumes: - db_data:/var/lib/mysql restart: always environment: - MYSQL_ROOT_PASSWORD:"password" - MYSQL_DATABASE:"root_db" - MYSQL_USER:"noco" - MYSQL_PASSWORD:"password" nocodb: # depends_on: # - root_db image: nocodb/nocodb:0.84.1 ports: - "8080:8080" volumes: - db_noco:/usr/app/data/ restart: always environment: - NC_DB:"mysql2://root_db:3306?u=noco&p=password&d=root_db" adminer: image: adminer:4.8.1 restart: always ports: - 8081:8080 volumes: db_data: {} db_noco: {}