9

I have a little issue with Wordpress image, will be thankful for any help.

I have existing database, which I import with dump.

My Mysql Dockerfile listing below:

FROM mariadb:10.1.20

COPY dump/dump.sql /docker-entrypoint-initdb.d

ENV MYSQL_ROOT_PASSWORD pass

CMD ["mysqld"]

This is Wordpress Dockerfile, here I import my wp-content folder from src directory:

FROM wordpress:latest

COPY ./src /var/www/html

ENV WORDPRESS_DB_PASSWORD pass
ENV WORDPRESS_DB_NAME db
ENV WORDPRESS_DB_HOST mysql:3306

And of course docker-compose.yml file:

version: '2'

services:
  mysql:
    build: mysql/
    restart: always
    volumes:
      - db_data:/var/lib/mysql
    container_name: mysql
  vshvetsov:
    depends_on:
      - mysql
    build: wordpress/
    ports:
      - 8000:80
    restart: always
    container_name: wordpress
volumes:
    db_data:

When I use plugin Contact Form 7 i've got an error with sending email after click button and of course don't get this message in my mailbox.

The only thing what I've found is this message:

172.18.0.1 - - [13/Jan/2017:13:52:42 +0000] "POST /const HTTP/1.1" 200 879 "http://localhost:8000/contacts" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
sh: 1: -t: not found

I've tried to install sendmail, but it still didn't help.

Thank you all for help.

I saw this issue, but it's not fixed at this moment.

Jesse Nickles
  • 1,435
  • 1
  • 17
  • 25
Vadim Shvetsov
  • 2,126
  • 2
  • 20
  • 28

2 Answers2

1

You can install ssmtp, as in : https://github.com/xgodon/RIG/blob/master/dockerized-apps/wordpress/Dockerfile

you just need a ssmtp.conf file like

mailhub=smtp.gmail.com:587
AuthUser=xxx@mail.com
AuthPass=
UseSTARTTLS=YES
# Allow the "From" email header.
FromLineOverride=YES

there is a delay (beacause no qualified host name) in the sending but here is the solution : https://www.digitalocean.com/community/questions/sendmail-is-slow-to-send-mail

i'll update the Dockerfile soon.

The_Pingu
  • 169
  • 6
0

You need to start the sendmail daemon.

The entrypoint docker-entrypoint.sh set in the image expects specific arguments. I was able to solve my issue by wrapping the original entrypoint and starting the sendmail daemon.

I have commented on the following thread:

https://github.com/docker-library/wordpress/issues/30#issuecomment-1483961348

wrapped-entrypoint.sh

#!/bin/bash

# Start the sendmail daemon
/usr/sbin/sendmail -bd

# Execute the original entrypoint script
exec docker-entrypoint.sh "$@"

Dockerfile

FROM docker.io/library/wordpress:php7.4-apache

# Install sendmail
RUN apt-get update && apt-get install -y sendmail && apt-get clean

# Copy the wrapped entrypoint script
COPY wrapped-entrypoint.sh /usr/local/bin/

# Make the script executable
RUN chmod +x /usr/local/bin/wrapped-entrypoint.sh

# Use the wrapped entrypoint
ENTRYPOINT ["wrapped-entrypoint.sh"]
Nao
  • 21
  • 6