Skip to content

[enhancement] run custom scripts right before service initialization #271

@acavalin

Description

@acavalin

Hello,

request

Is it possible to have in /scripts/run.sh a similar mechanism to execute_post_init_scripts function but running just before/after the announce_startup function? 🙏
It could be an execute_pre_init_scripts running all scripts within /docker-pre-init.d/ 🤔

context

I'm using this image in docker swarm and I would like to use docker secrets to pass DKIM keys to the container.

Docker secrets expose your secret values into the running container as files, for example:

# docker_swarm_compose.yml
services:
  mailer:
    image:    boky/postfix
    init:     false # this image uses supervisord init system
    secrets:  [ dkim_public_key, dkim_private_key ]

secrets:
  dkim_public_key:    { file: DKIM_PUBLIC_KEY.txt  }
  dkim_private_key:   { file: DKIM_PRIVATE_KEY.txt }

then in the container you will find these files:

/run/secrets/dkim_public_key
/run/secrets/dkim_private_key

I need to link/copy these files into /etc/opendkim/keys/domain_name.{txt,private} before the initialization scripts, I tried adding a custom script to /docker-init.d/ but it runs too late in /scripts/run.sh 😢

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions