Docker:初始化数据库不起作用
我有一个设置数据库的dockerfile。此dockerfile用于docker-compose文件。
当我运行$docker-compose up
时,我收到了以下错误:
恐慌:拨tcp 172.19.0.2:5432:connect:连接拒绝
FROM postgres:9.6
ENV POSTGRES_PORT=5432
ENV POSTGRES_USER=abc
ENV FLYWAY_VERSION 5.0.2
RUN apt-get update && apt-get install -y wget build-essential
RUN ["mkdir", "/src"]
RUN wget -q https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/$FLYWAY_VERSION/flyway-commandline-$FLYWAY_VERSION-linux-x64.tar.gz -P /src/
RUN tar xzf /src/flyway-commandline-$FLYWAY_VERSION-linux-x64.tar.gz -C /src/ RUN chmod +x /src/flyway-$FLYWAY_VERSION/flyway
ENV PATH=${PATH}:/src/flyway-$FLYWAY_VERSION
COPY Makefile /src/ COPY migrations /docker-entrypoint-initdb.d/migrations/ COPY flyway.test.conf /docker-entrypoint-initdb.d/
COPY bin/initdb.sh /docker-entrypoint-initdb.d/
EXPOSE $POSTGRES_PORT