Skip to content

Commit

Permalink
Resolve #63: Update to 3.5.5
Browse files Browse the repository at this point in the history
* Migrate to openjdk:8-jre-slim
  • Loading branch information
31z4 committed May 25, 2019
1 parent d062866 commit 01d134a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 36 deletions.
31 changes: 18 additions & 13 deletions 3.4.14/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
FROM openjdk:8-jre-alpine
FROM openjdk:8-jre-slim

# Install required packages
RUN apk add --no-cache \
bash \
su-exec
# Install required packges
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates \
dirmngr \
gosu \
gnupg \
wget; \
rm -rf /var/lib/apt/lists/*; \
# Verify that gosu binary works
gosu nobody true

ENV ZOO_USER=zookeeper \
ZOO_CONF_DIR=/conf \
Expand All @@ -19,20 +28,16 @@ ENV ZOO_USER=zookeeper \
ZOO_MAX_CLIENT_CNXNS=60

# Add a user and make dirs
RUN set -ex; \
adduser -D "$ZOO_USER"; \
RUN set -eux; \
useradd -r "$ZOO_USER"; \
mkdir -p "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" "$ZOO_LOG_DIR"; \
chown "$ZOO_USER:$ZOO_USER" "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" "$ZOO_LOG_DIR"

ARG GPG_KEY=3F7A1D16FA4217B1DC75E1C9FFE35B7F15DFA1BA
ARG DISTRO_NAME=zookeeper-3.4.14

# Download Apache Zookeeper, verify its PGP signature, untar and clean up
RUN set -ex; \
apk add --no-cache --virtual .build-deps \
ca-certificates \
gnupg \
libressl; \
RUN set -eux; \
wget -q "https://www.apache.org/dist/zookeeper/$DISTRO_NAME/$DISTRO_NAME.tar.gz"; \
wget -q "https://www.apache.org/dist/zookeeper/$DISTRO_NAME/$DISTRO_NAME.tar.gz.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
Expand All @@ -43,7 +48,7 @@ RUN set -ex; \
tar -xzf "$DISTRO_NAME.tar.gz"; \
mv "$DISTRO_NAME/conf/"* "$ZOO_CONF_DIR"; \
rm -rf "$GNUPGHOME" "$DISTRO_NAME.tar.gz" "$DISTRO_NAME.tar.gz.asc"; \
apk del .build-deps
chown -R "$ZOO_USER:$ZOO_USER" "/$DISTRO_NAME"

WORKDIR $DISTRO_NAME
VOLUME ["$ZOO_DATA_DIR", "$ZOO_DATA_LOG_DIR", "$ZOO_LOG_DIR"]
Expand Down
2 changes: 1 addition & 1 deletion 3.4.14/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
# Allow the container to be started with `--user`
if [[ "$1" = 'zkServer.sh' && "$(id -u)" = '0' ]]; then
chown -R "$ZOO_USER" "$ZOO_DATA_DIR" "$ZOO_DATA_LOG_DIR" "$ZOO_LOG_DIR" "$ZOO_CONF_DIR"
exec su-exec "$ZOO_USER" "$0" "$@"
exec gosu "$ZOO_USER" "$0" "$@"
fi

# Generate the config only if it doesn't exist
Expand Down
39 changes: 22 additions & 17 deletions 3.5.4-beta/Dockerfile → 3.5.5/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
FROM openjdk:8-jre-alpine
FROM openjdk:8-jre-slim

# Install required packages
RUN apk add --no-cache \
bash \
su-exec
# Install required packges
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates \
dirmngr \
gosu \
gnupg \
wget; \
rm -rf /var/lib/apt/lists/*; \
# Verify that gosu binary works
gosu nobody true

ENV ZOO_USER=zookeeper \
ZOO_CONF_DIR=/conf \
Expand All @@ -20,22 +29,19 @@ ENV ZOO_USER=zookeeper \
ZOO_STANDALONE_ENABLED=true

# Add a user and make dirs
RUN set -ex; \
adduser -D "$ZOO_USER"; \
RUN set -eux; \
useradd -r "$ZOO_USER"; \
mkdir -p "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" "$ZOO_LOG_DIR"; \
chown "$ZOO_USER:$ZOO_USER" "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" "$ZOO_LOG_DIR"

ARG GPG_KEY=D0BC8D8A4E90A40AFDFC43B3E22A746A68E327C1
ARG DISTRO_NAME=zookeeper-3.5.4-beta
ARG GPG_KEY=3F7A1D16FA4217B1DC75E1C9FFE35B7F15DFA1BA
ARG SHORT_DISTRO_NAME=zookeeper-3.5.5
ARG DISTRO_NAME=apache-zookeeper-3.5.5-bin

# Download Apache Zookeeper, verify its PGP signature, untar and clean up
RUN set -ex; \
apk add --no-cache --virtual .build-deps \
ca-certificates \
gnupg \
libressl; \
wget -q "https://www.apache.org/dist/zookeeper/$DISTRO_NAME/$DISTRO_NAME.tar.gz"; \
wget -q "https://www.apache.org/dist/zookeeper/$DISTRO_NAME/$DISTRO_NAME.tar.gz.asc"; \
RUN set -eux; \
wget -q "https://www.apache.org/dist/zookeeper/$SHORT_DISTRO_NAME/$DISTRO_NAME.tar.gz"; \
wget -q "https://www.apache.org/dist/zookeeper/$SHORT_DISTRO_NAME/$DISTRO_NAME.tar.gz.asc"; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-key "$GPG_KEY" || \
gpg --keyserver pgp.mit.edu --recv-keys "$GPG_KEY" || \
Expand All @@ -44,7 +50,6 @@ RUN set -ex; \
tar -zxf "$DISTRO_NAME.tar.gz"; \
mv "$DISTRO_NAME/conf/"* "$ZOO_CONF_DIR"; \
rm -rf "$GNUPGHOME" "$DISTRO_NAME.tar.gz" "$DISTRO_NAME.tar.gz.asc"; \
apk del .build-deps; \
chown -R "$ZOO_USER:$ZOO_USER" "/$DISTRO_NAME"

WORKDIR $DISTRO_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
# Allow the container to be started with `--user`
if [[ "$1" = 'zkServer.sh' && "$(id -u)" = '0' ]]; then
chown -R "$ZOO_USER" "$ZOO_DATA_DIR" "$ZOO_DATA_LOG_DIR" "$ZOO_LOG_DIR" "$ZOO_CONF_DIR"
exec su-exec "$ZOO_USER" "$0" "$@"
exec gosu "$ZOO_USER" "$0" "$@"
fi

# Generate the config only if it doesn't exist
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Supported tags and respective `Dockerfile` links

* `3.4.14`, `3.4`, `latest` [(3.4.14/Dockerfile)](https://github.com/31z4/zookeeper-docker/blob/master/3.4.14/Dockerfile)
* `3.5.4-beta`, `3.5` [(3.5.4-beta/Dockerfile)](https://github.com/31z4/zookeeper-docker/blob/master/3.5.4-beta/Dockerfile)
* `3.4.14`, `3.4` [(3.4.14/Dockerfile)](https://github.com/31z4/zookeeper-docker/blob/master/3.4.14/Dockerfile)
* `3.5.5`, `3.5`, `latest` [(3.5.5/Dockerfile)](https://github.com/31z4/zookeeper-docker/blob/master/3.5.5/Dockerfile)

[![](https://images.microbadger.com/badges/image/31z4/zookeeper.svg)](http://microbadger.com/images/31z4/zookeeper)

Expand Down Expand Up @@ -110,7 +110,7 @@ Defaults to `60`. ZooKeeper's `maxClientCnxns`

### `ZOO_STANDALONE_ENABLED`

Defaults to `true`. Zookeeper's [`standaloneEnabled`](http://zookeeper.apache.org/doc/r3.5.4-beta/zookeeperReconfig.html#sc_reconfig_standaloneEnabled)
Defaults to `true`. Zookeeper's [`standaloneEnabled`](http://zookeeper.apache.org/doc/r3.5.5/zookeeperReconfig.html#sc_reconfig_standaloneEnabled)

> Prior to 3.5.0, one could run ZooKeeper in Standalone mode or in a Distributed mode. These are separate implementation stacks, and switching between them during run time is not possible. By default (for backward compatibility) standaloneEnabled is set to true. The consequence of using this default is that if started with a single server the ensemble will not be allowed to grow, and if started with more than one server it will not be allowed to shrink to contain fewer than two participants.

Expand All @@ -137,7 +137,7 @@ The id must be unique within the ensemble and should have a value between 1 and

This variable allows you to specify a list of machines of the Zookeeper ensemble. Each entry has the form of `server.id=host:port:port`. Entries are separated with space. Do note that this variable will not have any effect if you start the container with a `/conf` directory that already contains the `zoo.cfg` file.

In 3.5, the syntax of this has changed. Servers should be specified as such: `server.id=<address1>:<port1>:<port2>[:role];[<client port address>:]<client port>` [Zookeeper Dynamic Reconfiguration](http://zookeeper.apache.org/doc/r3.5.4-beta/zookeeperReconfig.html)
In 3.5, the syntax of this has changed. Servers should be specified as such: `server.id=<address1>:<port1>:<port2>[:role];[<client port address>:]<client port>` [Zookeeper Dynamic Reconfiguration](http://zookeeper.apache.org/doc/r3.5.5/zookeeperReconfig.html)

## Where to store data

Expand Down

0 comments on commit 01d134a

Please sign in to comment.