Reputation: 3461
I have a docker-compose.yml file like this (you might have to go through the article in the link in it):
version: '3.3'
# + https://phauer.com/2017/test-mail-server-php-docker-container/
services:
mailhog:
container_name: mailhog_1
image: mailhog/mailhog:v1.0.0
ports:
- "1025:1025"
- "8025:8025"
db:
container_name: db_1
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_DATABASE: '...'
MYSQL_USER: 'wordpress'
MYSQL_PASSWORD: '...'
MYSQL_ROOT_PASSWORD: 1111
phpmyadmin:
container_name: phpmyadmin_1
depends_on:
- db
restart: always
ports:
- "8080:80"
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: db:3306
PMA_USER: root
PMA_PORT: 3306
PMA_PASSWORD: 1111
wordpress:
container_name: wordpress_1
depends_on:
- db
image: wordpress:latest
ports:
- "80:80"
volumes:
- type: bind
source: ./html
target: /var/www/html
volume:
nocopy: true
restart: always
environment:
WORDPRESS_DB_NAME: '...'
WORDPRESS_DB_USER: 'wordpress'
WORDPRESS_DB_PASSWORD: '...'
WORDPRESS_DB_HOST: db:3306 # in Duplicator
WORDPRESS_TABLE_PREFIX: 'wp_'
WORDPRESS_AUTH_KEY: 'pune fraza unică aici ...'
WORDPRESS_SECURE_AUTH_KEY: 'pune fraza unică aici ...'
WORDPRESS_LOGGED_IN_KEY: 'pune fraza unică aici ...'
WORDPRESS_NONCE_KEY: 'pune fraza unică aici ...'
WORDPRESS_AUTH_SALT: 'pune fraza unică aici ...'
WORDPRESS_SECURE_AUTH_SALT: 'pune fraza unică aici ...'
WORDPRESS_LOGGED_IN_SALT: 'pune fraza unică aici ...'
WORDPRESS_NONCE_SALT: 'pune fraza unică aici ...'
PATH: /usr/local/go/bin:$PATH
volumes:
db_data:
In the docker-compose up
log I get besides all other stuff these lines (the first is the interesting one for me):
wordpress_1 | sh: 1: -t: not found
wordpress_1 | 172.19.0.1 - - [10/Mar/2020:16:43:40 +0000] "POST /wp-json/contact-form-7/v1/contact-forms/9/feedback HTTP/1.1" 200 926 "http://localhost/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
mailhog_1 | [APIv1] KEEPALIVE /api/v1/events
I do not know why the email command does not work (on my front-end I use the Contact Form 7 plugin for WordPress). On the front end the click on the Submit button results in an error shown with red:
A apărut o eroare la încercarea de a trimite mesajul. Te rog să încerci din nou mai târziu.
which means
There is an error when attempting to send the message. Please try again later.
It is the second message in the Messages tab in the contact form page. I did not change any of the messages there.
Can anyone tell me what is the cause of the sh: 1: -t: not found
message from the wordpress_1 container?
Thank you.
Upvotes: 0
Views: 3538
Reputation: 345
sh: 1: -t: not found
is caused by wp_mail()
function failing to find /usr/sbin/sendmail
in the WordPress container.
To make your docker-compose setup work you'll need to build a custom WordPress image (possibly based upon the official image) which would include some sort of /usr/sbin/sendmail
emulation or implementation.
Upvotes: 2