Aristotle
发布于 2023-11-19 / 5 阅读 / 0 评论 / 0 点赞

docker-compose ENTRYPOINT 执行多条命令

docker-compose ENTRYPOINT 执行多条命令

方法一:

形如:

version: '3'
services:
  xrayr:
    # image: ghcr.io/xrayr-project/xrayr:latest
    image: ghcr.io/xrayr-project/xrayr:master

    volumes:
      - ./config:/etc/XrayR/ # 映射配置文件夹
    restart: always
    network_mode: host
    entrypoint: ["/bin/sh","-c","cp /etc/XrayR/pxcert.pem /usr/local/share/ca-certificates/ && update-ca-certificates && XrayR --config /etc/XrayR/config.yml"]

方法二:

形如:

entrypoint: ["sh","./setup.sh"]

setup.sh如下

#!/bin/bash
cp ./reuqest-center_rsyslog.conf /etc/rsyslog.d/reuqest-center_rsyslog.conf
 
 
cp ./rsyslog.conf /etc/rsyslog.conf
 
/sbin/rsyslogd &> /dev/null & pm2-runtime ./build/bin/worker.js -i 30 --name woker