I am working with Docker and its containers and I want to add more than 1 WordPress site in its containers with Nginx, PHP and Letscrypt. I have 1 container with the database, 2 containers with wordpress and phpfpm7.4. Another container with nginx and 2 more containers with certbot to generate the ssl certificates I already have the docker-compose.yml file but it seems that the problem I have is with a second certbot container that is not generating the certificate. Here I leave the docker file and the error it throws me.
version: '3'
services:
dbgb:
image: mysql:8.0.30
container_name: dbgb
restart: unless-stopped
env_file: .env
environment:
- MYSQL_ROOT_PASSWORD=Wordpress123
- MYSQL_DATABASE=greatbytedb
- MYSQL_USER=wordpressuser
- MYSQL_PASSWORD=Wordpress321
volumes:
- dbdata:/var/lib/mysql
command: '--default-authentication-plugin=mysql_native_password'
networks:
- app-network
wordpressgb:
depends_on:
- dbgb
image: wordpress:6.0.2-php7.4-fpm-alpine
container_name: wordpressgb
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=dbgb:3306
- WORDPRESS_DB_USER=$MYSQL_USER
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- WORDPRESS_DB_NAME=greatbytedb
volumes:
- greatbyte:/var/www/html
networks:
- app-network
wordpresshc:
depends_on:
- dbgb
image: wordpress:6.0.2-php7.4-fpm-alpine
container_name: wordpresshc
restart: unless-stopped
env_file: .env
environment:
- WORDPRESS_DB_HOST=dbgb:3306
- WORDPRESS_DB_USER=$MYSQL_USER
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
- WORDPRESS_DB_NAME=greatbytedb
volumes:
- hablamedecuba:/var/www/html/hablamedecuba
networks:
- app-network
webservergb:
depends_on:
- wordpressgb
- wordpresshc
image: nginx:1.23.1-alpine
container_name: webservergb
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- greatbyte:/var/www/html
- hablamedecuba:/var/www/html/hablamedecuba
- ./nginx-conf:/etc/nginx/conf.d
- certbot-etc:/etc/letsencrypt
networks:
- app-network
certbotgb:
depends_on:
- webservergb
image: certbot/certbot
container_name: certbotgb
volumes:
- certbot-etc:/etc/letsencrypt
- greatbyte:/var/www/html
command: certonly --webroot --webroot-path=/var/www/html --email [email protected] --agree-tos --no-eff-email --force-renewal -d great-byte.com -d www.great-byte.com
certbothc:
depends_on:
- webservergb
image: certbot/certbot
container_name: certbothc
volumes:
- certbot-etc:/etc/letsencrypt
- hablamedecuba:/var/www/html/hablamedecuba
command: certonly --webroot --webroot-path=/var/www/html/hablamedecuba --email [email protected] --agree-tos --no-eff-email --force-renewal -d hablamedecuba.com -d www.hablamedecuba.com
volumes:
certbot-etc:
greatbyte:
hablamedecuba:
dbdata:
networks:
app-network:
driver: bridge
2
Answers
The challenge cannot be execute because
hablamedecuba.com
isn’t reachable for lets’ encrypt to download the temporary challenge file.You try after add below code.
or
This link enter link description here is ready to install full stack docker compose wordpress. I suggest you try, tried and it is work.