My original goal is to secure a WordPress website using Certbot.
My method is to compose up WordPress container then install Certbot on this container.
So it should be a combination of 2 commands:
- WordPress default entry command “apache2-foreground”
- Then executing my shell script
Compose file looks like:
version: '3.1' services: wordpress: image: wordpress # certbot_https_setup.sh includes simple instructions for installing certbot on website. It works for sure. command: bash -c "apache2-foreground && bash /path/to/script/certbot_https_setup.sh" restart: always ports: - 8080:80 environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: exampleuser WORDPRESS_DB_PASSWORD: examplepass WORDPRESS_DB_NAME: exampledb volumes: - wordpress:/var/www/html db: image: mysql:5.7 restart: always environment: MYSQL_DATABASE: exampledb MYSQL_USER: exampleuser MYSQL_PASSWORD: examplepass MYSQL_RANDOM_ROOT_PASSWORD: '1' volumes: - db:/var/lib/mysql volumes: wordpress: db:
What happens is that apache start but my script does not get executed…
I have tried many other variation trying to pass run apache2-foreground and my script afterward, but none has worked.
Does someone know what am I exactly missing here?
Many thanks in advance!