我使用的是docker-compose.yml
,其中我描述了2种服务,一种用于前端应用程序,第二种用于后端:
version: '2'
services:
cdl-front:
build: cdl-web/.
ports:
- "80:80"
depends_on:
- cdl-rest
cdl-rest:
build: cdl-rest/.
ports:
- "7777:7777"
当我尝试使用配置有Docker插件的IntelliJ IDEA启动docker-compose配置时,出现此错误:
错误:服务'cdl-front'生成失败:COPY失败:统计 /var/lib/docker/tmp/docker-builder939775883/nginx.conf:没有这样的文件 或目录无法部署'Compose:docker-compose.yml':
docker-compose
进程以退出代码1完成 下面是我的2个dockerfile,描述了2个服务:
cdl-front包含以下dockerfile
:
FROM nginx
WORKDIR .
COPY nginx.conf /etc/nginx/nginx.conf
COPY cdl-frontend/cdl /usr/share/nginx/html
cdl-rest包含此dockerfile
# Start with a base image containing Java runtime
FROM openjdk:8-jdk-alpine
# Add Maintainer Info
LABEL maintainer="ghassen1khalil@gmail.com"
# Add a volume pointing to /tmp
VOLUME /tmp
# Make port 8080 available to the world outside this container
EXPOSE 9091
# The application's jar file
ARG JAR_FILE=target/cdl-rest-1.0-SNAPSHOT.jar
# Add the application's jar to the container
ADD ${JAR_FILE} cdl-rest.jar
# Run the jar file
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom -Dfile.encoding=UTF-8","-jar","/cdl-rest.jar"]
CMD ["--env=prod"]