I have configure the next Dockerfile and it works fine:
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD farr-api-0.1.0.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
Now I would like to run the same but using docker-compose, so I try to use the same sintaxys, this is my docker-compose.yml:
Docker-compose.yml:
jar:
image: frolvlad/alpine-oraclejdk8:slim
volumes:
- /tmp
add: "farr-api-0.1.0.jar" "app.jar"
command: sh -c 'touch /app.jar'
environment:
JAVA_OPTS=""
entrypoint: [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
It throws the next fail:
ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 2, column 3
expected <block end>, but found '<scalar>'
in "./docker-compose.yml", line 5, column 29
I think it could be sintax problem
Docker-compose version 1.8.1
You have two syntax errors in your docker-compose.yml
file:
Docker-Compose does not support the add
command. If you want to add a file to your container, you either have to do that in a Dockerfile
(and use that from the compose file), or map in the file through a volume
.
volumes:
- "./farr-api-0.1.0.jar:/app.jar"
The environment
section expects an array - you need to prefix the JAVA_OPTS
line with a dash:
environment:
- JAVA_OPTS=""
You can find more details in the Docker-Compose documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With