-
Notifications
You must be signed in to change notification settings - Fork 303
Open
Description
I am trying to automate setting up my wordpress site using this docker-compose configuration.
This is the manual step which I do atm:
docker exec -it myapp-wordpress bash
and then inside the docker container:
wp core install --url=myapp.local --title="MyApp" --admin_user=admin --admin_password=secret --admin_email=foo@bar.com
# other wp commands
This works fine and I am able to access the site. I would like to automate this step along with a few other wp
commands. My target is to keep these commands in a shell script and then run it from a Dockerfile via CMD
.
Currently, I am just executing wp core install
as a part of the Dockerfile to test but executing it as a part of Docker messes up some configuration which I am unable to figure out:
...
RUN mkdir -p /var/www/.wp-cli/cache && chown www-data:www-data /var/www/.wp-cli/cache
# sleep is required so that MySQL is ready to accept requests
CMD sleep 10 && wp core install --url=myapp.local --title="MyApp" --admin_user=admin --admin_password=secret --admin_email=foo@bar.com && tail -f /dev/null
I start getting 502 while trying to access the website. On the terminal, I can see this:
myapp-wordpress | Success: WordPress installed successfully.
myapp-nginx | 2024/01/19 08:19:12 [error] 36#36: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: myapp.local, request: "GET /wp/wp-admin/ HTTP/2.0", upstream: "fastcgi://172.19.0.4:9000", host: "myapp.local"
Any pointers on how to execute these wp
commands as a part of docker compose?
Metadata
Metadata
Assignees
Labels
No labels