[英]Jenkins and Ant - ant.bat not recognized but env vars are set well
[英]Docker not catching env vars
我試圖通過docker-compose運行3個容器,使用postgres,cassandra和我的webapp,它有一個嵌入式tomcat服務器,有一些依賴關系作為ARP / Native。 這個庫位於jar級別的名為“lib”的文件夾中。
我在Windows 10上運行PoC(使用Linux容器),然后將其移動到CentOS服務器,如果它在PoC上運行的話。 我在網上搜索,似乎不是一個孤立的問題,但或者我找不到解決方案,或者解決方案顯示我沒有工作。 這是我的docker-compose.yml,所有相關的文件/文件夾都存放在同一級別:
version: '3.1'
services:
fulmar-webapp:
container_name: "my-webapp"
image: openjdk:11-jre-slim
hostname: mywebapp
volumes:
- ./lib:/home/lib
- ./fulmar-1.0.1-SNAPSHOT-exec.jar:/home/mywebapp-1.0.1-SNAPSHOT-exec.jar
entrypoint:
- java
- -jar
- /home/mywebapp-1.0.1-SNAPSHOT-exec.jar
environment:
- LD_LIBRARY_PATH:/home/lib
- spring.datasource.url=jdbc:postgresql://postgresql:5432/mydb
- spring.datasource.username=postgres
- spring.datasource.password=postgres
- spring.jpa.hibernate.ddlAuto=update
network_mode: bridge
ports:
- 8443:8443
- 8080:8080
links:
- postgresql
- cassandra
postgresql:
container_name: "mydb"
image: postgres:11.1-alpine
restart: always
environment:
POSTGRES_DB: mydb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- ./startup.sql:/docker-entrypoint-initdb.d/startup.sql
- postgresdata:/var/lib/postgresql/data
ports:
- 5432:5432
network_mode: bridge
cassandra:
container_name: "cassandra"
image: cassandra
ports:
- 9042:9042
network_mode: bridge
卷:postgresdata:
不確定是否未正確映射文件夾與庫,或實際上沒有安裝卷。 這正是我需要放入的Enviroment var:Environment = LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/ path / to / libraries / lib
我遇到的兩個結果:
1-Tomcat異常導致它無法找到庫:
[ERROR][org.apache.catalina.util.LifecycleBase#log(175)] Failed to
initialize component [Connector[org.apache.coyote.http11.Http11AprProtocol-
8080]] | org.apache.catalina.LifecycleException: The configured protocol
[org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library
which is not available
2-WARNING:未設置LD_LIBRARY_PATH變量。 默認為空字符串。
提前謝謝大家
編輯:只是讓你知道,一旦我運行docker-compose,我的應用程序拋出此異常,容器不再可用,所以我無法在其中運行任何命令
你的語法錯誤,它應該是這樣的:
environment:
- LD_LIBRARY_PATH=/home/lib
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.