How can I make a docker-compose file with mailhog and wordpress images work?

admin

Administrator
Staff member
I have a docker-compose.yml file like this (you might have to go through <a href="https://phauer.com/2017/test-mail-server-php-docker-container/" rel="nofollow noreferrer">the article</a> in the link in it):

<pre class="lang-yaml prettyprint-override">
Code:
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
Code:
docker-compose up
log I get besides all other stuff these lines (the first is the interesting one for me):

Code:
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:

<blockquote>
A apărut o eroare la încercarea de a trimite mesajul. Te rog să încerci din nou mai târziu.
</blockquote>

which means

<blockquote>
There is an error when attempting to send the message. Please try again later.
</blockquote>

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
Code:
sh: 1: -t: not found
message from the wordpress_1 container?

Thank you.