Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions docs/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,53 @@ limitations under the License.

<div id="toc"></div>

## Overview
This document contains instructions about making docker containers for Zeppelin. It mainly provides guidance into how to create, publish and run docker images for zeppelin releases.

## Quick Start
### Installing Docker

You need to [install docker](https://docs.docker.com/engine/installation/) on your machine.

### Creating and Publishing Zeppelin docker image
### Official Docker Images

#### Running Official Docker Images

```bash
$ docker run -it --name zeppelin --rm -p 8080:8080 -p 7077:7077 zeppelin:tag
```

Supported tags and respective `Dockerfile` links

* `alpine-0.6.2_java`
* `alpine-0.6.2_r` (has R related packages based on `alpine_java` images)
* `alpine-0.6.2_python` (has python related packages based on `alpine_java` images)

Since alpine linux doesn't have graphical device, some function may not work (e.g `plot` in R)

#### Creating Official Dockerfiles

Currently, zeppelin supports alpine linux docker images

```bash
$ scripts/docker/zeppelin-bin-all/create-dockerfile.sh -h

USAGE: ./create-dockerfile.sh version linux platform
* version: 0.6.2 (released zeppelin binary version)
* linux: [alpine]
* platform: [java, python, r]

# for example
$ ./create-dockerfile.sh 0.6.2 alpine java
```

### Custom Docker Images

#### Creating and Publishing Zeppelin docker image
* In order to be able to create and/or publish an image, you need to set the **DockerHub** credentials `DOCKER_USERNAME, DOCKER_PASSWORD, DOCKER_EMAIL` variables as environment variables.

* To create an image for some release use :
`create_release.sh <release-version> <git-tag>`.
* To publish the created image use :
`publish_release.sh <release-version> <git-tag>`

### Running a Zeppelin docker image
#### Running a Zeppelin docker image

* To start Zeppelin, you need to pull the zeppelin release image:
```
Expand All @@ -65,6 +96,5 @@ docker run -p 7077:7077 -p 8080:8080 --privileged=true -v $PWD/logs:/logs -v $PW
/usr/local/zeppelin/bin/zeppelin.sh
```


* Zeppelin will run at `http://localhost:8080`.

42 changes: 0 additions & 42 deletions scripts/docker/zeppelin-base/Dockerfile

This file was deleted.

54 changes: 54 additions & 0 deletions scripts/docker/zeppelin-base/alpine/java/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM alpine:3.4
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV LOG_TAG="[ZEPPELIN_BASE]:" \
LANG=C.UTF-8 \
DUMBINIT_VERSION="1.2.0"

RUN echo "$LOG_TAG Install basic packages" && \
apk update && \
echo "http://dl-1.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-2.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-3.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-5.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-6.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk add --no-cache bash dumb-init curl wget && \
rm -rf /var/cache/apk/*

RUN echo "$LOG_TAG Install java ${JAVA_VERSION}" && \
{ \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home

ENV JAVA_HOME=/usr/lib/jvm/java-1.7-openjdk \
PATH=$PATH:/usr/lib/jvm/java-1.7-openjdk/jre/bin:/usr/lib/jvm/java-1.7-openjdk/bin \
JAVA_VERSION=7u121 \
JAVA_ALPINE_VERSION=7.121.2.6.8-r0

RUN set -x \
&& apk add --no-cache \
openjdk7="$JAVA_ALPINE_VERSION" \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
44 changes: 44 additions & 0 deletions scripts/docker/zeppelin-base/alpine/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM zeppelin:alpine-base_java
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV LOG_TAG="[ZEPPELIN_BASE_PYTHON]:"

RUN echo "$LOG_TAG Install required packages" && \
echo @testing http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --no-cache --virtual=build_deps build-base make gcc g++ tar

RUN echo "$LOG_TAG Install python related packages" && \
# for numpy: https://github.com/docker-library/python/issues/112
ln -s /usr/include/locale.h /usr/include/xlocale.h && \
apk add --no-cache --virtual=python_deps \
py-numpy freetype libpng tk tcl && \
apk add --no-cache --virtual=python_build_deps \
musl-dev linux-headers gfortran \
freetype-dev py-numpy-dev@testing \
py-numpy python-dev libpng-dev libxml2-dev libxslt-dev \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py-numpy is here and L30?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix it

tk-dev tcl-dev && \
apk add --no-cache python py-pip && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir numpy matplotlib

RUN echo "$LOG_TAG Cleanup" && \
apk del build_deps && \
apk del python_build_deps
Copy link
Contributor

@mfelgamal mfelgamal Dec 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to install and delete the packages in the same layer (on one line) so it’s not committed to the image as separate layers to reduce the image size. What do you think?

Copy link
Member Author

@1ambda 1ambda Dec 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfelgamal Thanks for review :)

  • I agree but we need to keep the balance between readability and size i think. So there are many official images having multiple RUN commands. For example, openjdk. Additionally, separating layers also affects on build time (productivity) while developing docker images.
  • Let me compare image sizes and add comments about it :)

Copy link
Member

@felixcheung felixcheung Dec 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from experience it might be useful also to have multiple layers (ie RUN command) for reliability - these cached images are helpful as checkpoints to resume from if one of these step fails



52 changes: 52 additions & 0 deletions scripts/docker/zeppelin-base/alpine/r/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM zeppelin:alpine-base_java
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV LOG_TAG="[ZEPPELIN_BASE_R]:" \
LANG=C.UTF-8 \
R_VERSION="3.3.1-r0" \
R_LIBS="/usr/local/rbin/R"
Copy link
Member

@felixcheung felixcheung Dec 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R_LIBS is optional - is there a reason you want to create/pass this, instead of using just the default location?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know it. I will fix it.


RUN echo "$LOG_TAG Install required packages" && \
apk add --update --virtual=build_deps build-base make gcc g++ tar

RUN echo "$LOG_TAG Install R related packages" && \
mkdir -p $R_LIBS && \
echo 'R_LIBS=$R_LIBS' >> $R_LIBS/.Renviron && \
curl --silent --location https://github.com/sgerrand/alpine-pkg-R/releases/download/${R_VERSION}/R-${R_VERSION}.apk \
--output /var/cache/apk/R-${R_VERSION}.apk && \
apk add --no-cache --allow-untrusted /var/cache/apk/R-${R_VERSION}.apk && \
curl --silent --location https://github.com/sgerrand/alpine-pkg-R/releases/download/${R_VERSION}/R-dev-${R_VERSION}.apk \
--output /var/cache/apk/R-dev-${R_VERSION}.apk && \
apk add --no-cache --allow-untrusted /var/cache/apk/R-dev-${R_VERSION}.apk && \
R -e "install.packages('knitr', repos='http://cran.us.r-project.org', lib='$R_LIBS')" && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could pass a list of packages to install.packages()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought separating install packages statements into multiple lies would be easy to maintain. But it's ok to keep it one line. I will fix it.

R -e "install.packages('ggplot2', repos='http://cran.us.r-project.org', lib='$R_LIBS')" && \
R -e "install.packages('googleVis', repos='http://cran.us.r-project.org', lib='$R_LIBS')" && \
R -e "install.packages('data.table', repos='http://cran.us.r-project.org', lib='$R_LIBS')" && \
# for devtools, Rcpp
apk add --no-cache --virtual=r_build_deps curl-dev openssl-dev -y && \
R -e "install.packages('devtools', repos='http://cran.us.r-project.org', lib='$R_LIBS')" && \
R -e "install.packages('Rcpp', repos='http://cran.us.r-project.org', lib='$R_LIBS')" && \
Rscript -e "library('devtools', lib.loc='$R_LIBS'); library('Rcpp', lib.loc='$R_LIBS'); devtools::install_github('ramnathv/rCharts', lib='$R_LIBS')"

RUN R -e "install.packages('gridSVG', repos='http://cran.us.r-project.org', lib='$R_LIBS')"

RUN echo "$LOG_TAG Cleanup" && \
apk del build_deps && \
apk del r_build_deps && \
rm -rf /tmp
33 changes: 33 additions & 0 deletions scripts/docker/zeppelin-bin-all/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM zeppelin:tag
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV Z_VERSION="0.0.0"
ENV LOG_TAG="[ZEPPELIN_${Z_VERSION}]:" \
Z_HOME="/zeppelin"

RUN echo "$LOG_TAG install zeppelin ${Z_VERSION}" && \
wget http://archive.apache.org/dist/zeppelin/zeppelin-${Z_VERSION}/zeppelin-${Z_VERSION}-bin-all.tgz && \
tar -zxvf /zeppelin-${Z_VERSION}-bin-all.tgz && \
rm -rf /zeppelin-${Z_VERSION}-bin-all.tgz && \
mv /zeppelin-${Z_VERSION}-bin-all ${Z_HOME}

EXPOSE 8080 7077

WORKDIR ${Z_HOME}
CMD ["bin/zeppelin.sh"]
33 changes: 33 additions & 0 deletions scripts/docker/zeppelin-bin-all/alpine/0.6.0_java/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM zeppelin:alpine-base_java
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV Z_VERSION="0.6.0"
ENV LOG_TAG="[ZEPPELIN_${Z_VERSION}]:" \
Z_HOME="/zeppelin"

RUN echo "$LOG_TAG install zeppelin ${Z_VERSION}" && \
wget http://archive.apache.org/dist/zeppelin/zeppelin-${Z_VERSION}/zeppelin-${Z_VERSION}-bin-all.tgz && \
tar -zxvf /zeppelin-${Z_VERSION}-bin-all.tgz && \
rm -rf /zeppelin-${Z_VERSION}-bin-all.tgz && \
mv /zeppelin-${Z_VERSION}-bin-all ${Z_HOME}

EXPOSE 8080 7077

WORKDIR ${Z_HOME}
CMD ["bin/zeppelin.sh"]
33 changes: 33 additions & 0 deletions scripts/docker/zeppelin-bin-all/alpine/0.6.0_python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM zeppelin:alpine-base_python
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV Z_VERSION="0.6.0"
ENV LOG_TAG="[ZEPPELIN_${Z_VERSION}]:" \
Z_HOME="/zeppelin"

RUN echo "$LOG_TAG install zeppelin ${Z_VERSION}" && \
wget http://archive.apache.org/dist/zeppelin/zeppelin-${Z_VERSION}/zeppelin-${Z_VERSION}-bin-all.tgz && \
tar -zxvf /zeppelin-${Z_VERSION}-bin-all.tgz && \
rm -rf /zeppelin-${Z_VERSION}-bin-all.tgz && \
mv /zeppelin-${Z_VERSION}-bin-all ${Z_HOME}

EXPOSE 8080 7077

WORKDIR ${Z_HOME}
CMD ["bin/zeppelin.sh"]
33 changes: 33 additions & 0 deletions scripts/docker/zeppelin-bin-all/alpine/0.6.0_r/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM zeppelin:alpine-base_r
MAINTAINER Apache Software Foundation <dev@zeppelin.apache.org>

ENV Z_VERSION="0.6.0"
ENV LOG_TAG="[ZEPPELIN_${Z_VERSION}]:" \
Z_HOME="/zeppelin"

RUN echo "$LOG_TAG install zeppelin ${Z_VERSION}" && \
wget http://archive.apache.org/dist/zeppelin/zeppelin-${Z_VERSION}/zeppelin-${Z_VERSION}-bin-all.tgz && \
tar -zxvf /zeppelin-${Z_VERSION}-bin-all.tgz && \
rm -rf /zeppelin-${Z_VERSION}-bin-all.tgz && \
mv /zeppelin-${Z_VERSION}-bin-all ${Z_HOME}

EXPOSE 8080 7077

WORKDIR ${Z_HOME}
CMD ["bin/zeppelin.sh"]
Loading