diff --git a/bitnami/elasticsearch/7/ol-7/Dockerfile b/bitnami/elasticsearch/7/ol-7/Dockerfile index ecef62d89390..27e7eabec263 100644 --- a/bitnami/elasticsearch/7/ol-7/Dockerfile +++ b/bitnami/elasticsearch/7/ol-7/Dockerfile @@ -18,7 +18,7 @@ RUN curl --silent -L https://github.com/mikefarah/yq/releases/download/2.4.0/yq_ COPY rootfs / RUN /postunpack.sh ENV BITNAMI_APP_NAME="elasticsearch" \ - BITNAMI_IMAGE_VERSION="7.4.2-ol-7-r26" \ + BITNAMI_IMAGE_VERSION="7.4.2-ol-7-r27" \ LD_LIBRARY_PATH="/opt/bitnami/elasticsearch/jdk/lib:/opt/bitnami/elasticsearch/jdk/lib/server:$LD_LIBRARY_PATH" \ NAMI_PREFIX="/.nami" \ PATH="/opt/bitnami/java/bin:/opt/bitnami/elasticsearch/bin:$PATH" diff --git a/bitnami/elasticsearch/7/ol-7/prebuildfs/usr/local/bin/install_packages b/bitnami/elasticsearch/7/ol-7/prebuildfs/usr/local/bin/install_packages index 4218ab93690a..370f3516f403 100755 --- a/bitnami/elasticsearch/7/ol-7/prebuildfs/usr/local/bin/install_packages +++ b/bitnami/elasticsearch/7/ol-7/prebuildfs/usr/local/bin/install_packages @@ -1,20 +1,29 @@ #!/bin/sh -set -e -set -u -n=0 +set -eu + +if [[ -n "oracle-epel-release-el7" ]]; then + if ! yum list installed oracle-epel-release-el7 >/dev/null 2>&1; then + yum -y install oracle-epel-release-el7 >/dev/null 2>&1 + CODE=$? + if (( $CODE != 0 )); then + echo "EPEL repository installation failed" + exit $CODE + fi + fi +fi + max=2 -until [ $n -gt $max ]; do +for ((n = 1 ; n <= max ; n+=1 )); do set +e yum --enablerepo base,updates,ol7_developer_EPEL,ol7_optional_latest install -y "$@" CODE=$? set -e - if [ $CODE -eq 0 ]; then + if (( $CODE == 0 )); then break fi - if [ $n -eq $max ]; then + if (( $n == $max )); then exit $CODE fi echo "yum failed, retrying" - n=$(($n + 1)) done rm -r /var/cache/yum diff --git a/bitnami/elasticsearch/7/ol-7/rootfs/postunpack.sh b/bitnami/elasticsearch/7/ol-7/rootfs/postunpack.sh index 08fffd06601a..7b8b407abc38 100755 --- a/bitnami/elasticsearch/7/ol-7/rootfs/postunpack.sh +++ b/bitnami/elasticsearch/7/ol-7/rootfs/postunpack.sh @@ -9,7 +9,18 @@ # Load Elasticsearch environment variables eval "$(elasticsearch_env)" -for dir in "$ELASTICSEARCH_TMPDIR" "$ELASTICSEARCH_DATADIR" "$ELASTICSEARCH_LOGDIR" "${ELASTICSEARCH_BASEDIR}/plugins" "${ELASTICSEARCH_BASEDIR}/modules" "${ELASTICSEARCH_CONFDIR}/scripts"; do +for dir in "$ELASTICSEARCH_TMPDIR" "$ELASTICSEARCH_DATADIR" "$ELASTICSEARCH_LOGDIR" "${ELASTICSEARCH_BASEDIR}/plugins" "${ELASTICSEARCH_BASEDIR}/modules" "${ELASTICSEARCH_CONFDIR}"; do ensure_dir_exists "$dir" + chmod -R ug+rwX "$dir" + # `elasticsearch-plugin install` command complains about being unable to create the a plugin's directory + # even when having the proper permissions. + # The reason: the code is checking trying to check the permissions by consulting the parent directory owner, + # instead of checking if the ES user actually has writing permissions. + # + # As a workaround, we will ensure the container works (at least) with the non-root user 1001. However, + # until we can avoid this hack, we can't guarantee this container to work on K8s distributions + # where containers are exectued with non-privileged users with random user IDs. + # + # Issue reported at: https://github.com/bitnami/bitnami-docker-elasticsearch/issues/50 + chown -R 1001:0 "$dir" done -chmod -R g+rwX "$ELASTICSEARCH_CONFDIR" "$ELASTICSEARCH_TMPDIR" "$ELASTICSEARCH_DATADIR" "$ELASTICSEARCH_LOGDIR" "${ELASTICSEARCH_BASEDIR}/plugins" "${ELASTICSEARCH_BASEDIR}/modules" diff --git a/bitnami/elasticsearch/README.md b/bitnami/elasticsearch/README.md index 457c84f650af..6c384ba3020d 100644 --- a/bitnami/elasticsearch/README.md +++ b/bitnami/elasticsearch/README.md @@ -46,7 +46,7 @@ Non-root container images add an extra layer of security and are generally recom Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/). -* [`7-ol-7`, `7.4.2-ol-7-r26` (7/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/7.4.2-ol-7-r26/7/ol-7/Dockerfile) +* [`7-ol-7`, `7.4.2-ol-7-r27` (7/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/7.4.2-ol-7-r27/7/ol-7/Dockerfile) * [`7-debian-9`, `7.4.2-debian-9-r10`, `7`, `7.4.2`, `7.4.2-r10`, `latest` (7/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/7.4.2-debian-9-r10/7/debian-9/Dockerfile) * [`6-ol-7`, `6.8.5-ol-7-r0` (6/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/6.8.5-ol-7-r0/6/ol-7/Dockerfile) * [`6-debian-9`, `6.8.5-debian-9-r0`, `6`, `6.8.5`, `6.8.5-r0` (6/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-elasticsearch/blob/6.8.5-debian-9-r0/6/debian-9/Dockerfile)