我已经创建了一个简单的rest终结点,它将返回Hello世界进行Get操作。我创建了docker文件来推送
FROM openjdk:8
RUN mkdir -p /usr/local/app
WORKDIR /usr/local/app
COPY /SpringRest/target/docker-spring.jar /usr/local/app/docker-spring.jar
EXPOSE 8085
ENTRYPOINT ["java","-jar","docker-spring.jar"]
当我尝试使用VSTS运行它时,出现以下错误:
Status: Downloaded newer image for openjdk:8
2018-07-23T10:51:00.4948836Z ---> 8c80ddf988c8
2018-07-23T10:51:00.4966564Z Step 2/6 : RUN mkdir -p /usr/local/app
2018-07-23T10:51:14.7731002Z ---> Running in 2242c1baadde
2018-07-23T10:51:16.5140472Z Removing intermediate container 2242c1baadde
2018-07-23T10:51:16.5163574Z ---> b8dba30e6e9c
2018-07-23T10:51:16.5179644Z Step 3/6 : WORKDIR /usr/local/app
2018-07-23T10:51:17.8398811Z Removing intermediate container 47a1a4cf9a23
2018-07-23T10:51:17.8418756Z ---> 9fc455c476e0
2018-07-23T10:51:17.8437188Z Step 4/6 : COPY /SpringRest/target/docker-spring.jar /usr/local/app/docker-spring.jar
2018-07-23T10:51:17.8457664Z ***COPY failed: stat /var/lib/docker/tmp/docker-builder484497191/SpringRest/target/docker-spring.jar: no such file or directory
2018-07-23T10:51:17.8581142Z ##[error]COPY failed: stat /var/lib/docker/tmp/docker-builder484497191/SpringRest/target/docker-spring.jar: no such file or directory***
2018-07-23T10:51:17.8659023Z ##[error]/usr/local/bin/docker failed with return code: 1
我缺少任何步骤吗?请帮帮我
答案 0 :(得分:0)
尝试一下:
FROM openjdk:8
RUN mkdir -p /usr/local/app
WORKDIR /usr/local/app
RUN cd /SpringRest/target
COPY docker-spring.jar /usr/local/app/
EXPOSE 8085
ENTRYPOINT ["java","-jar","docker-spring.jar"]
FROM openjdk:8
WORKDIR /SpringRest/target
EXPOSE 8085
ENTRYPOINT ["java","-jar","docker-spring.jar"]