Failed to create the Postgres docker image using Colima. ( error: could not create file)

Description

Hello, I am using this code to create the container for the postgres but it’s failing.

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
      

At first, I was getting permission denied issues. Solve it after following this https://github.com/abiosoft/colima/issues/83#issuecomment-1339269542
After that issue was solved, I started getting

      2024-05-27 08:21:10.743 UTC [40] FATAL:  could not create file "base/13066/2618": File exists

Version

colima version 0.6.9
git commit: c3a31ed05f5fab8b2cdbae835198e8fb1717fd0f

runtime: docker
arch: aarch64
client: v26.1.3
server: v26.1.1

Operating System

  • [ ] macOS Intel <= 13 (Ventura)
  • [ ] macOS Intel >= 14 (Sonoma)
  • [ ] Apple Silicon <= 13 (Ventura)
  • [X] Apple Silicon >= 14 (Sonoma)
  • [ ] Linux

Output of 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

Reproduction Steps

Expected behaviour

The image should be created without any error.

Additional context

Complete log during the creation of Postgres image.

[+] 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

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật