I am trying to understand the dockerfile here after ( it comes from here : https://hub.docker.com/r/jplock/zookeeper/~/dockerfile/ )
What I don't understand is the VOLUME ["/opt/zookeeper/conf", "/tmp/zookeeper"] part...
From Docker's doc I read :
The VOLUME instruction creates a mount point with the specified name
and marks it as holding externally mounted volumes from native host or
other containers. The value can be a JSON array, VOLUME ["/var/log/"], or a
plain string with multiple arguments, such as VOLUME /var/log or VOLUME
/var/log /var/db. For more information/examples and mounting instructions
via the Docker client, refer to Share Directories via Volumes
documentation.
So What I understand is that I could have a local file which would take place of the container's file. So I created a file in my local hard-drive :
$ cat /opt/zookeeper/conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=3000
And hope the [VOLUME] function would place it on top of the by default [zoo.cfg] in the container. Unfortunately, launching the container I still see a ticktime at 2000 (last line) :
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
2016-12-05 13:13:18,728 [myid:] - INFO [main:QuorumPeerConfig@124] - Reading configuration from: /opt/zookeeper/bin/../conf/zoo.cfg
2016-12-05 13:13:18,736 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2016-12-05 13:13:18,737 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2016-12-05 13:13:18,738 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2016-12-05 13:13:18,740 [myid:] - WARN [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running in standalone mode
2016-12-05 13:13:18,763 [myid:] - INFO [main:QuorumPeerConfig@124] - Reading configuration from: /opt/zookeeper/bin/../conf/zoo.cfg
2016-12-05 13:13:18,764 [myid:] - INFO [main:ZooKeeperServerMain@96] - Starting server
2016-12-05 13:13:18,781 [myid:] - INFO [main:Environment@100] - Server environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
2016-12-05 13:13:18,781 [myid:] - INFO [main:Environment@100] - Server environment:host.name=11586b93e1ff
2016-12-05 13:13:18,782 [myid:] - INFO [main:Environment@100] - Server environment:java.version=1.8.0_92-internal
2016-12-05 13:13:18,782 [myid:] - INFO [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2016-12-05 13:13:18,783 [myid:] - INFO [main:Environment@100] - Server environment:java.home=/usr/lib/jvm/java-1.8-openjdk/jre
2016-12-05 13:13:18,783 [myid:] - INFO [main:Environment@100] - Server environment:java.class.path=/opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/opt/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/opt/zookeeper/bin/../lib/log4j-1.2.16.jar:/opt/zookeeper/bin/../lib/jline-0.9.94.jar:/opt/zookeeper/bin/../zookeeper-3.4.9.jar:/opt/zookeeper/bin/../src/java/lib/*.jar:/opt/zookeeper/bin/../conf:
2016-12-05 13:13:18,784 [myid:] - INFO [main:Environment@100] - Server environment:java.library.path=/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2016-12-05 13:13:18,785 [myid:] - INFO [main:Environment@100] - Server environment:java.io.tmpdir=/tmp
2016-12-05 13:13:18,785 [myid:] - INFO [main:Environment@100] - Server environment:java.compiler=<NA>
2016-12-05 13:13:18,789 [myid:] - INFO [main:Environment@100] - Server environment:os.name=Linux
2016-12-05 13:13:18,789 [myid:] - INFO [main:Environment@100] - Server environment:os.arch=amd64
2016-12-05 13:13:18,790 [myid:] - INFO [main:Environment@100] - Server environment:os.version=4.4.27-moby
2016-12-05 13:13:18,790 [myid:] - INFO [main:Environment@100] - Server environment:user.name=root
2016-12-05 13:13:18,791 [myid:] - INFO [main:Environment@100] - Server environment:user.home=/root
2016-12-05 13:13:18,791 [myid:] - INFO [main:Environment@100] - Server environment:user.dir=/opt/zookeeper
2016-12-05 13:13:18,803 [myid:] - INFO [main:ZooKeeperServer@815] - tickTime set to 2000
So I don't understand the VOLUME Commande :(
FROM openjdk:8-jre-alpine
MAINTAINER Justin Plock <justin@plock.net>
ARG MIRROR=http://apache.mirrors.pair.com
ARG VERSION=3.4.9
LABEL name="zookeeper" version=$VERSION
RUN apk add --no-cache wget bash \
&& mkdir /opt \
&& wget -q -O - $MIRROR/zookeeper/zookeeper-$VERSION/zookeeper-$VERSION.tar.gz | tar -xzf - -C /opt \
&& mv /opt/zookeeper-$VERSION /opt/zookeeper \
&& cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg \
&& mkdir -p /tmp/zookeeper
EXPOSE 2181 2888 3888
WORKDIR /opt/zookeeper
VOLUME ["/opt/zookeeper/conf", "/tmp/zookeeper"]
ENTRYPOINT ["/opt/zookeeper/bin/zkServer.sh"]
CMD ["start-foreground"]