我的简单Spring启动项目Docker容器问题

时间:2021-04-20 13:11:08

标签: java docker

我的 docker-compose.yml 文件

  version: "3.9"
  services:
    webapp:
     image: springbootproject
       build: .
     ports:
       - "8085:8085"
     depends_on:
       - postgres
       - pgadmin
   postgres:
      container_name: postgres_container
 image: postgres
 environment:
   POSTGRES_USER: postgres
   POSTGRES_PASSWORD: 12345
   PGDATA: /data/postgres
volumes:
   - postgres:/data/postgres
 ports:
  - "5432:5432"
networks:
  - postgres
restart: unless-stopped

 pgadmin:
   container_name: pgadmin_container
   image: dpage/pgadmin4
 environment:
   PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
   PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
   PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
   - pgadmin:/root/.pgadmin

ports:
  - "${PGADMIN_PORT:-80}:80"
networks:
  - postgres
restart: unless-stopped

networks:
   postgres:
     driver: bridge

volumes:
 postgres:
 pgadmin:

Dockerfile

  FROM adoptopenjdk:11-jre-hotspot
  ARG JAR_FILE=target/*.jar
  COPY ${JAR_FILE} springmvcrestapi.jar
  EXPOSE 8085
  ENTRYPOINT ["java","-jar","springmvcrestapi.jar"]

大家好,我的简单项目使用 docker inteelij ide 终端编写 docker-compose up postgre 和 pgadmin 工作容器,但我的项目图像错误:无法访问 jarfile springmvcrestapi-0.0.1-SNAPSHOT.jar 什么有什么问题吗??

0 个答案:

没有答案