You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Colima创建Postgres Docker容器失败,报文件已存在错误

问题描述

我使用以下Docker Compose配置创建Postgres容器,但创建失败:

version: "3.1"

services:
  postgres:
    image: postgres:11.14
    container_name: elementspostgres
    ports:
      - "5432:5432"
    env_file:
      - ./.env
    volumes:
      - ./db/data:/var/lib/postgresql/data
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql

最初遇到权限拒绝问题,解决后出现如下错误:

2024-05-27 08:21:10.743 UTC [40] FATAL:  could not create file "base/13066/2618": File exists
版本信息
  • colima版本:0.6.9,git commit: c3a31ed05f5fab8b2cdbae835198e8fb1717fd0f
  • runtime: docker
  • 架构:aarch64
  • Docker客户端版本:v26.1.3
  • Docker服务端版本:v26.1.1
操作系统
  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux
colima status输出
INFO[0000] Colima is running using QEMU
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: 9p
INFO[0000] socket: unix:///Users/<USERNAME>/.colima/default/docker.sock
复现步骤

(原步骤未填写)

预期行为

容器应无错误创建成功。

附加信息

创建容器时的完整日志:

[+] Running 2/0
 ✔ Network elements-node_default  Created                                                                                        0.0s
 ✔ Container elementspostgres     Created                                                                                        0.0s
Attaching to elementspostgres
elementspostgres  | The files belonging to this database system will be owned by user "postgres".
elementspostgres  | This user must also own the server process.
elementspostgres  |
elementspostgres  | The database cluster will be initialized with locale "en_US.utf8".
elementspostgres  | The default database encoding has accordingly been set to "UTF8".
elementspostgres  | The default text search configuration will be set to "english".
elementspostgres  |
elementspostgres  | Data page checksums are disabled.
elementspostgres  |
elementspostgres  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
elementspostgres  | creating subdirectories ... ok
elementspostgres  | selecting default max_connections ... 100
elementspostgres  | selecting default shared_buffers ... 128MB
elementspostgres  | selecting default timezone ... Etc/UTC
elementspostgres  | selecting dynamic shared memory implementation ... posix
elementspostgres  | creating configuration files ... ok
elementspostgres  | running bootstrap script ... ok
elementspostgres  | 2024-05-27 08:21:10.743 UTC [40] FATAL:  could not create file "base/13066/2618": File exists
elementspostgres  | 2024-05-27 08:21:10.743 UTC [40] STATEMENT:  CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
elementspostgres  |
elementspostgres  | child process exited with exit code 1
elementspostgres  | initdb: removing contents of data directory "/var/lib/postgresql/data"
elementspostgres  | performing post-bootstrap initialization ...
elementspostgres exited with code 1

内容的提问来源于stack exchange,提问作者Ravi Sigdel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 06:36:10