The docker-compose mysql volumes directory mount problem caused the container to fail to start!

it"s OK to mount the directory directly through the command line run-v, but I have a problem when I mount the directory through compose volumes. Other nginx redis mount directory files are normal, but mysql is not successful. I can mount the my.cnf configuration file, but as long as I mount the data directory or other directory, it will fail to start.

  mysql5.7:
    build: ./mysql5.7/
    networks:
      app_net:
        ipv4_address: 172.168.88.50
    ports:
      - 3306:3306
    volumes:
      - $PWD/mysql5.7/data:/app/mysql/data

dockerFile

FROM alpine:latest
LABEL maintainer "MYSQL Docker Maintainer <myxingke@126.com>"

WORKDIR /app
VOLUME /app
COPY startup.sh /startup.sh

RUN apk add --update mysql mysql-client && rm -f /var/cache/apk/*
COPY my.cnf /etc/my.cnf

EXPOSE 3306
CMD ["/startup.sh"]

do you have a partner to help me see what caused it?


$PWD/ for. / try?

Menu