Websoft9 / docker-library

Docker Compose examples of selfhosted FOSS based on official image, just run it.
https://www.websoft9.com
Other
36 stars 25 forks source link

Use Post-start hooks to replace all cmd.sh combined with ENTRYPOINT and COMMAND #945

Open chendelin1982 opened 1 week ago

chendelin1982 commented 1 week ago

What type of your feature request?

Websoft9 have add cmd.sh together with ENTRYPOINT and COMMAND, but it may make container error

Post-start hooks are commands that run after the container has started, but there's no set time for when exactly they will execute.

services:
  app:
    image: backend
    user: 1001
    volumes:
      - data:/data    
    post_start:
      - command: chown -R /data 1001:1001
        user: root

volumes:
  data: {} # a Docker volume is created with root ownership

It can be used after Docker Compose v2.30