'Why my docker-compose yaml file can't see jar file?
I have this yaml file
version: '2'
services:
app1:
image: producer1
build:
context: .
ports:
- "8088:8088"
networks:
- lognet1
zookeeper:
image: wurstmeister/zookeeper
networks:
- lognet1
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
networks:
- lognet1
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100
KAFKA_MESSAGE_MAX_BYTES: 2000000
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.99.100:9092
KAFKA_BROKER_ID: 0
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
networks:
lognet1:
driver: overlay
and Docerfile
FROM adoptopenjdk:11-jre-hotspot
ARG JAR_FILE=*.jar
COPY ${JAR_FILE} application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
and jar in the same directory, but after compose upping it doesn't see new changes so it can't read jar,I tried so run them differently it worked,but with dcoker compose not
Solution 1:[1]
Running this command should work:
docker-compose up -d --build --force-recreate app1
Else, run the second command:
docker-compose build --no-cache app1 && docker-compose up -d
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Saeed |
