containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
8.16k stars 609 forks source link

unsupport configs filed #3098

Open xjdtd opened 5 months ago

xjdtd commented 5 months ago

What is the problem you're trying to solve

docker-compose.yaml configs: create_db_sql: content: | CREATE DATABASE kuboard DEFAULT CHARACTER SET = 'utf8mb4' DEFAULT COLLATE = 'utf8mb4_unicode_ci'; create user 'kuboard'@'%' identified by 'kuboardpwd'; grant all privileges on kuboard.* to 'kuboard'@'%'; FLUSH PRIVILEGES;

services: db: image: swr.cn-east-2.myhuaweicloud.com/kuboard/mariadb:11.3.2-jammy environment: MARIADB_ROOT_PASSWORD: kuboardpwd MYSQL_ROOT_PASSWORD: kuboardpwd TZ: Asia/Shanghai volumes:

networks: kuboard_v4_dev: driver: bridge

[root@master01 v4]# ./nerdctl/bin/nerdctl compose -f docker-compose.yaml up WARN[0000] Ignoring: config create_db_sql: [Content]
FATA[0000] config "create_db_sql": lacks file path
You have new mail in /var/spool/mail/root [root@master01 v4]# ./nerdctl/bin/nerdctl --version nerdctl version 2.0.0-beta.5 You have new mail in /var/spool/mail/root

Describe the solution you'd like

want nertctl to support docker-compose.yaml like above file

Additional context

No response

Zheaoli commented 5 months ago

would you mind formatting your yaml file first?

xjdtd commented 5 months ago

docker-compose.yaml.log @Zheaoli

apostasie commented 5 months ago

Inline here:


configs:
  create_db_sql:
    content: |
      CREATE DATABASE kuboard DEFAULT CHARACTER SET = 'utf8mb4' DEFAULT COLLATE = 'utf8mb4_unicode_ci';
      create user 'kuboard'@'%' identified by 'kuboardpwd';
      grant all privileges on kuboard.* to 'kuboard'@'%';
      FLUSH PRIVILEGES;

services:
  db:
    image: swr.cn-east-2.myhuaweicloud.com/kuboard/mariadb:11.3.2-jammy
    # image: mariadb:11.3.2-jammy  
    # swr.cn-east-2.myhuaweicloud.com/kuboard/mariadb:11.3.2-jammy 与 mariadb:11.3.2-jammy 镜像完全一致
    environment:
      MARIADB_ROOT_PASSWORD: kuboardpwd
      MYSQL_ROOT_PASSWORD: kuboardpwd
      TZ: Asia/Shanghai
    volumes:
      - ./kuboard-mariadb-data:/var/lib/mysql:Z
    configs:
      - source: create_db_sql
        target: /docker-entrypoint-initdb.d/create_db.sql
        mode: 0777
    networks:
      kuboard_v4_dev:
        aliases:
          - db
  kuboard:
    image: swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v4
    # image: eipwork/kuboard:v4
    environment:
      - DB_DRIVER=org.mariadb.jdbc.Driver
      - DB_URL=jdbc:mariadb://db:3306/kuboard?serverTimezone=Asia/Shanghai
      - DB_USERNAME=kuboard
      - DB_PASSWORD=kuboardpwd
    ports:
      - '8000:80'
    depends_on:
      - db
    networks:
      kuboard_v4_dev:
        aliases:
          - kuboard

networks:
  kuboard_v4_dev:
    driver: bridge

I am not super familiar with compose-go or what we do for compose in here, but it seems to me that the issue is that configs does apparently not support flat content instead of a file path - https://github.com/compose-spec/compose-spec/blob/master/08-configs.md#example-2