Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Script always running on ENTRYPOINT dockerfile but i only want him to run once

Writer Andrew Henderson

I tried to set up a Wordpress solution (installing by myself and not using an official image). I have one container with Apache, PHP and Mariadb-client (to interrogate Mariadb-server from another container)

I have another container with Mariadbon it.

I use wp-cli to configure Wordpress website but when i build my docker image, I can't execute the command (inside sh file) which is

wp core config --allow-root --dbname=$MYSQL_DATABASE --dbuser=$MYSQL_USER --dbpass=$MYSQL_PASSWORD --dbhost=172.20.0.2 --dbprefix=wp --path=/var/www/html/wordpress

because my Mariadb container isn't up.

So I tried to run this script with entrypoint parameters and when I do my docker-compose up, my script is played and I have the message:

apache-php_SDV | Success: Generated 'wp-config.php' file.
apache-php_SDV | Error: The 'wp-config.php' file already exists.

My script is played every second, I tried to use CMD before and it doesn't work, it's like CMD wasn't run

I have the same result if I want to put CMD after ENTRYPOINT, I can run my script only when both containers are up.

I also tried to use command on my docker-compose.yml but not helpful. Does anyone have a solution?

2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy