'how to create customized Wordpress docker image and remove default plugins and themes from official docker image
you can use wp cli to do it in dokcer container instance launching.
We need add shell script in a official image file in /usr/local/bin/docker-entrypoint.sh. So use command 'docker cp' copy the file to local path.
edit local file: find the line(at 67):
echo >&2 "Complete! WordPress has been successfully copied to $PWD"add below shell script after that line.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar php wp-cli.phar --info chmod +x wp-cli.phar mv wp-cli.phar /usr/local/bin/wp wp --info wp plugin list --allow-root wp plugin delete hello --allow-root wp plugin delete akismet --allow-root wp theme list --allow-root wp theme delete twentynineteen --allow-root wp theme delete twentytwenty --allow-root wp theme delete twentytwentyone --allow-rootAdd below lines in your Dockerfile
FROM wordpress:latest ADD ./wp-content /var/www/html/wp-content ADD ./wp-config.php /var/www/html/wp-config.php ADD ./vendor /var/www/html/vendor ADD ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh WORKDIR /var/www/html EXPOSE 80 CMD ["apache2-foreground"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
