小编dmi*_*vim的帖子

使用postgres配置dockerfile

试图为我的应用程序制作postgres db的Dockerfile.

Dockerfile

FROM postgres:9.4
RUN mkdir /sql
COPY src/main/resources/sql_scripts/* /sql/
RUN psql -f /sql/create_user.sql
RUN psql -U user -W 123 -f create_db.sql
RUN psql -U user -W 123 -d school_ats -f create_tables.sql
Run Code Online (Sandbox Code Playgroud)

docker build .
Run Code Online (Sandbox Code Playgroud)

结果:

Sending build context to Docker daemon 3.367 MB
Step 1 : FROM postgres:9.4
 ---> 6196bca94565
Step 2 : RUN mkdir /sql
 ---> Using cache
 ---> 6f57c1e759b7
Step 3 : COPY src/main/resources/sql_scripts/* /sql/
 ---> Using cache
 ---> 3b496bfb28cd
Step 4 : RUN psql …
Run Code Online (Sandbox Code Playgroud)

postgresql psql docker dockerfile

6
推荐指数
1
解决办法
9034
查看次数

OffsetDateTime解析

需要从格式中解析日期时间2016-06-24T13:39:44.687680.

第一步使用,尝试用行解析没有微秒的时间.

System.out.println(OffsetDateTime.parse("2011-12-03T10:15:30", DateTimeFormatter.ISO_LOCAL_DATE_TIME));
Run Code Online (Sandbox Code Playgroud)

有例外

Exception in thread "main" java.time.format.DateTimeParseException: Text '2011-12-03T10:15:30' could not be parsed: Unable to obtain OffsetDateTime from TemporalAccessor: {},ISO resolved to 2011-12-03T10:15:30 of type java.time.format.Parsed
    at java.time.format.DateTimeFormatter.createError(DateTimeFormatter.java:1920)
    at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1855)
    at java.time.OffsetDateTime.parse(OffsetDateTime.java:402)
    at timeread.TimeReading.main(TimeReading.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.time.DateTimeException: Unable to obtain OffsetDateTime from TemporalAccessor: {},ISO resolved to 2011-12-03T10:15:30 of type java.time.format.Parsed
    at java.time.OffsetDateTime.from(OffsetDateTime.java:370)
    at java.time.format.Parsed.query(Parsed.java:226)
    at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
    ... 7 more
Caused by: java.time.DateTimeException: Unable to …
Run Code Online (Sandbox Code Playgroud)

java datetime

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

datetime ×1

docker ×1

dockerfile ×1

java ×1

postgresql ×1

psql ×1