1

The command '/bin/sh -c mysql -u wordpress -pwordpress wordpress < /docker-entrypoint-initdb.d/wordpress.sql' returned a non-zero code: 1

My docker File :

From mysql:5.7

ENV MYSQL_ROOT_PASSWORD="************"
ENV MYSQL_USER="*******"
ENV MYSQL_PASSWORD="*********"
ENV MYSQL_DATABASE="********"

EXPOSE 3306 3366

COPY wordpress.sql /docker-entrypoint-initdb.d/.
RUN mysql -u wordpress -pwordpress wordpress < /docker-entrypoint-initdb.d/wordpress.sql
2
  • Hi, it may be good to also provide your wordpress.sql or the part of it that is essential for someone to understand potential issues. Commented Apr 4, 2019 at 11:03
  • You don't need to RUN anything - .sql in /docker-entrypoint-initdb.d/ will be automatically executed. Note though it will only run the first time the container is generated, so make sure to remove the container and any data volume and then try restarting. Some relevant links - example with Dockerfile, one with docker-compose. If it still fails, maybe some problem in your sql file. Commented Apr 4, 2019 at 12:35

1 Answer 1

0

You don't need the last line "RUN ..."

Mysql container automatically runs whatever you copy in /docker-entrypoint-initdb.d/. This happens when you run the container, not during build.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.