Skip to content

Running a shell script on each container startup (mysql:5.6) #304

@lukpre

Description

@lukpre

Hey everyone

I do have a question regarding running a shell script on every container startup using the official mysql:5.6 image. Currently i have been using the standard image and entrypoint, that have sourced different databases via /docker-entrypoint-initdb.d this all works great.

Now i do have a shell script which queries a database to check different values from the db against environment variables on the system. This also works well, when i run the script from within the container (manually) or when i put it into the /docker-entrypoint-initdb.d folder.

My Problem now is, that /docker-entrypoint-initdb.d doesn't help for me task, because i need to run the script not only on the container creation, rather then on every start of the container.

Adding it to the official entrypoint script itself didn't help, because i need the databases sourced and mysqld to be running before the script does its job. And since mysqld just gets called from the CMD statement i am a bit stuck.

So i was wondering if anybody here could give me an advice how to properly implement this, or update the entrypoint script correspondingly.

Thank you very much.

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