Skip to content

Docker-compose.yml and custom script after entrypoint (before command) #205

Closed
@Ciantic

Description

@Ciantic

I have fairly simple need, and have been struggling with this many hours now. I want to run some script after entrypoint, and before command. I've tried running it as a command but no luck.

docker-compose.yml

---
version: '2'
services:
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
  wordpress:
    image: wordpress:latest
    volumes:
     - "./wp-init.sh:/usr/local/bin/wp-init.sh"
    depends_on:
    - db
    ports:
    - 80:80
    restart: always
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: wordpress
    entrypoint: docker-entrypoint.sh
    command: /usr/local/bin/wp-init.sh
volumes:
  db_data: 

wp-init.sh

# I would do my thing here, but this ain't running the wp 

# execute CMD
exec "apache2-foreground" # this seems to be running just fine

If I start this, I only get forbidden from browser. It starts up normally if I comment entrypoint and command though.

I've also tried creating a dockerfile, like in the issue #130, but it didn't work with docker compose either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions