我一直在尝试将需要连接到postgresql数据库的spring引导应用程序停靠。当我构建一个运行容器,虽然它崩溃抛出标题中提到的错误。谁能指出我做错了什么?感谢
我的Dockerfile
FROM ubuntu
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.5 postgresql-client-9.5 postgresql-contrib-9.5 openjdk-8-jdk
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
USER postgres
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER vova WITH SUPERUSER PASSWORD 'vova';" &&\
createdb -O vova springbootdb
RUN echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/9.5/main/pg_hba.conf
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
USER root
# create the work directory
RUN mkdir -p /usr/src/smartExtensionsBackend
RUN mkdir -p /usr/local/pgsql/data
WORKDIR /usr/src/smartExtensionsBackend
# copy all source files to the work directory
COPY . /usr/src/smartExtensionsBackend
#grab gradle
RUN apt-get install -y gradle
#build application
RUN gradle build
#start application
CMD ["sh","init.sh"]
#expose port 8083
EXPOSE 8083
我从容器内部提取了postgres日志文件
2017-10-19 03:12:51.333 UTC [21] LOG: database system was shut down at 2017-10-19 03:11:46 UTC
2017-10-19 03:12:51.374 UTC [21] LOG: MultiXact member wraparound protections are now enabled
2017-10-19 03:12:51.376 UTC [20] LOG: database system is ready to accept connections
2017-10-19 03:12:51.377 UTC [25] LOG: autovacuum launcher started
2017-10-19 03:12:51.607 UTC [27] [unknown]@[unknown] LOG: incomplete startup packet
2017-10-19 03:35:26.946 UTC [35] LOG: database system was interrupted; last known up at 2017-10-19 03:13:03 UTC
2017-10-19 03:35:27.220 UTC [36] [unknown]@[unknown] LOG: incomplete startup packet
2017-10-19 03:35:27.735 UTC [39] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:28.250 UTC [42] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:28.765 UTC [45] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:29.280 UTC [48] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:29.797 UTC [51] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:30.314 UTC [54] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:30.829 UTC [57] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:31.345 UTC [60] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:31.862 UTC [63] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:32.379 UTC [66] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:32.896 UTC [69] postgres@postgres FATAL: the database system is starting up
2017-10-19 03:35:32.969 UTC [70] [unknown]@[unknown] LOG: incomplete startup packet