Docker从已安装的驱动器设置容器env变量

时间:2018-01-29 17:40:37

标签: docker docker-compose dockerfile

这是docker-compose.yml

version: "2"

services:
  service:
    container_name: PDP-${ACTIVE_PROFILE}-API
    image: imge-name/api:v${TAG}
  build:
    context: .
  ports:
    - "${PORT}:8282"
  volumes:
  - /mnt/data/env_file:/application/env_file
  environment:
    JAVA_OPTS: -Xmx1024m -Xms512m -Dspring.profiles.active=${ACTIVE_PROFILE}
    POM_VERSION_DOCKER: ${POM_VERSION}

这些变量使用jenkins导出,效果很好

这是Dockerfile

.....
ENTRYPOINT ["./docker-entrypoint.sh"]

这是docker-entrypoint.sh

source ./env_file   - THIS IS PROBLEM env_file is unavailable
java ${JAVA_OPTS} -jar ./target/api-${POM_VERSION}.jar  - This is problem also JAVA_OPTS is unavailable as well as POM_VERSION

0 个答案:

没有答案