Skip to content

Commit

Permalink
[FLINK-3155] Update docker flink container to the latest release
Browse files Browse the repository at this point in the history
[FLINK-3155] Make docker image execute as non-root user (l:flink)

[FLINK-3155] Change default FLINK_HOME from /usr/local/flink to /opt/flink

[FLINK-3155] Make install path configuragle, simplify mirror based download

[FLINK-3155] Upgrade default docker version to 1.1.1

This closes apache#2340
  • Loading branch information
iemejia authored and mxm committed Aug 17, 2016
1 parent c894896 commit 889c63e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
24 changes: 15 additions & 9 deletions flink-contrib/docker-flink/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,31 @@ FROM java:8-jre-alpine
RUN apk add --no-cache bash snappy

# Configure Flink version
ARG FLINK_VERSION=1.0.3
ARG FLINK_VERSION=1.1.1
ARG HADOOP_VERSION=27
ARG SCALA_VERSION=2.11

# Flink environment variables
ARG FLINK_INSTALL_PATH=/opt
ENV FLINK_HOME $FLINK_INSTALL_PATH/flink
ENV PATH $PATH:$FLINK_HOME/bin

# Install build dependencies and flink
RUN set -x && \
mkdir -p $FLINK_INSTALL_PATH && \
apk --update add --virtual build-dependencies curl && \
curl -s $(curl -s https://www.apache.org/dyn/closer.cgi\?as_json\=1 | \
awk '/preferred/ {gsub(/"/,""); print $2}')flink/flink-${FLINK_VERSION}/flink-${FLINK_VERSION}-bin-hadoop${HADOOP_VERSION}-scala_${SCALA_VERSION}.tgz | \
tar xvz -C /usr/local/ && \
ln -s /usr/local/flink-$FLINK_VERSION /usr/local/flink && \
sed -i -e "s/echo \$mypid >> \$pid/echo \$mypid >> \$pid \&\& wait/g" /usr/local/flink/bin/flink-daemon.sh && \
curl -s $(curl -s https://www.apache.org/dyn/closer.cgi\?preferred\=true)flink/flink-${FLINK_VERSION}/flink-${FLINK_VERSION}-bin-hadoop${HADOOP_VERSION}-scala_${SCALA_VERSION}.tgz | \
tar xvz -C $FLINK_INSTALL_PATH && \
ln -s $FLINK_INSTALL_PATH/flink-$FLINK_VERSION $FLINK_HOME && \
addgroup -S flink && adduser -D -S -H -G flink -h $FLINK_HOME flink && \
chown -R flink:flink $FLINK_INSTALL_PATH/flink-$FLINK_VERSION && \
chown -h flink:flink $FLINK_HOME && \
sed -i -e "s/echo \$mypid >> \$pid/echo \$mypid >> \$pid \&\& wait/g" $FLINK_HOME/bin/flink-daemon.sh && \
apk del build-dependencies && \
rm -rf /var/cache/apk/*

ENV FLINK_HOME /usr/local/flink
ENV PATH $PATH:$FLINK_HOME/bin

# Configure container
USER flink
ADD docker-entrypoint.sh $FLINK_HOME/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["sh", "-c"]
3 changes: 1 addition & 2 deletions flink-contrib/docker-flink/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
- "48081:8081"
command: jobmanager
volumes:
- /usr/local/flink/conf
- /opt/flink/conf

taskmanager:
image: flink
Expand All @@ -33,4 +33,3 @@ services:
command: taskmanager
volumes_from:
- jobmanager:ro

0 comments on commit 889c63e

Please sign in to comment.