ergo icon indicating copy to clipboard operation
ergo copied to clipboard

Docker latest image unable to find /home/ergo/ergo.jar

Open vinnielima opened this issue 2 years ago • 3 comments

Using latest image as of 5/26/2022:

ergoplatform/ergo latest 0cfa52ff5834 3 days ago 315MB When running instance:

docker run -d -p 9030:9030 -p 9053:9053 -v /opt/nodehistory:/home/ergo -v /mnt/ergonodeconf/ergo.conf:/etc/myergo.conf -e MAX_HEAP=3G ergoplatform/ergo:latest --mainnet -c /etc/myergo.conf Produces:

Error: Unable to access jarfile /home/ergo/ergo.jar Previously it would also error not able to find /home/ergo/.ergo per documentation. Is this possibly an issue with the Dockerfile not creating the user? Both mount points to local host are chown 9052 and chmod 777.

Attempted docker pull v4.0.30 and v4.0.29 same issue.

vinnielima avatar May 27 '22 01:05 vinnielima

Isn't -v /opt/nodehistory:/home/ergo masking the image's own /home/ergo ?

abchrisxyz avatar May 27 '22 02:05 abchrisxyz

By rebuilding the container using my own Dockerfile, i was able to get it to operate. Yes, -v /opt/nodehistory:/home/ergo is supposed to mount docker host node history for the node so it doesn't have to resync the whole blockchain.

Using the following Dockerfile:

FROM openjdk:11-jre-slim
RUN adduser --disabled-password --home /home/ergo --uid 9052 --gecos "ErgoPlatform" ergo && \
    install -m 0750 -o ergo -g ergo -d /home/ergo/.ergo
USER ergo
EXPOSE 9020 9052 9030 9053
WORKDIR /home/ergo
VOLUME ["/home/ergo/.ergo"]
ENV MAX_HEAP 3G
ENV _JAVA_OPTIONS "-Xmx${MAX_HEAP}"
COPY ergo.jar /home/ergo/ergo.jar
ENTRYPOINT ["java", "-jar", "/home/ergo/ergo.jar"]

And the following container startup gets past this error, which tells me something is not right with the originally created docker image (it may not be copying the ergo.jar where you think it is):

docker run -d -p 9030:9030 -p 9053:9053 --name ERGO-NODE --restart on-failure --net ergo-mainnet -v /opt/nodehistory:/home/ergo/.ergo -v /mnt/ergonodeconf/ergo.conf:/etc/myergo.conf -e MAX_HEAP=6G -e JAVA_OPTIONS=-Xmx6G -e _JAVA_OPTIONS=-Xmx6G <IMAGE> --mainnet -c /etc/myergo.conf

vinnielima avatar May 28 '22 17:05 vinnielima

In your last example you're mapping /opt/nodehistory to /home/ergo/.ergo, which is fine. The command in your first comment was mapping it to /home/ergo, which is where the jar resides.

abchrisxyz avatar May 28 '22 21:05 abchrisxyz