You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by kaelumania <gi...@git.apache.org> on 2017/01/10 11:15:11 UTC

[GitHub] flink pull request #3086: Improve docker setup

GitHub user kaelumania opened a pull request:

    https://github.com/apache/flink/pull/3086

    Improve docker setup

    Improves the overall docker setup


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kaelumania/flink improve-docker-setup

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/3086.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3086
    
----
commit 1c82018de20a74d4d548bb6d95f0de453c6b5374
Author: Stephan Epping <st...@zweitag.de>
Date:   2017-01-10T11:11:27Z

    Make build.sh executable

commit a11f6ab273c3a4c2472fdfd01612963d0146df44
Author: Stephan Epping <st...@zweitag.de>
Date:   2017-01-10T11:11:41Z

    Fix Dockerfile using ARG instead of ENV

commit 1e1b274a6970e300a90bff3b5decf7d2153b9002
Author: Stephan Epping <st...@zweitag.de>
Date:   2017-01-10T11:12:34Z

    Prevent exit only for job-/taskmanger shortcuts

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95383742
  
    --- Diff: flink-contrib/docker-flink/docker-entrypoint.sh ---
    @@ -36,9 +39,9 @@ elif [ "$1" == "taskmanager" ]; then
         echo "Starting Task Manager"
         echo "config file: " && grep '^[^\n#]' $FLINK_HOME/conf/flink-conf.yaml
         $FLINK_HOME/bin/taskmanager.sh start
    +
    +  # prevent script to exit
    +  tail -f /dev/null
     else
         $@
    --- End diff --
    
    When this image is used as a one-off container, e.g. I want to run `bin/flink list`, then this line would prevent the one-off container to exit correctly - instead it would hang forever.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95384257
  
    --- Diff: flink-contrib/docker-flink/Dockerfile ---
    @@ -22,9 +22,9 @@ FROM java:8-jre-alpine
     RUN apk add --no-cache bash snappy
     
     # Configure Flink version
    -ENV FLINK_VERSION=1.1.1
    -ENV HADOOP_VERSION=27
    -ENV SCALA_VERSION=2.11
    +ARG FLINK_VERSION=1.1.3
    --- End diff --
    
    Thus, this was basically a bug.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95411011
  
    --- Diff: flink-contrib/docker-flink/docker-entrypoint.sh ---
    @@ -28,6 +28,9 @@ if [ "$1" == "jobmanager" ]; then
     
         echo "config file: " && grep '^[^\n#]' $FLINK_HOME/conf/flink-conf.yaml
         $FLINK_HOME/bin/jobmanager.sh start cluster
    +
    +  # prevent script to exit
    +  tail -f /dev/null
    --- End diff --
    
    I think the proper way to fix this, would be to call a non-daemonized startup script.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    @mxn One drawback using `ENV` might be with docker-compose, see https://docs.docker.com/compose/compose-file/#/args which states
    
    > You can omit the value when specifying a build argument, in which case its value at build time is the value in the environment where Compose is running.
    
    > Note: If your service specifies a build option, variables defined in environment will not be automatically visible during the build. Use the args sub-option of build to define build-time environment variables.
    
    On the other hand the Dockerfile reference says (https://docs.docker.com/engine/reference/builder/#/arg)
    
    > Unlike an ARG instruction, ENV values are always persisted in the built image.
    
    Maybe something like this can be used to support both
    ```
    1 FROM ubuntu
    2 ARG CONT_IMG_VER
    3 ENV CONT_IMG_VER ${CONT_IMG_VER:-v1.0.0}
    4 RUN echo $CONT_IMG_VER
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by greghogan <gi...@git.apache.org>.
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95381935
  
    --- Diff: flink-contrib/docker-flink/Dockerfile ---
    @@ -22,9 +22,9 @@ FROM java:8-jre-alpine
     RUN apk add --no-cache bash snappy
     
     # Configure Flink version
    -ENV FLINK_VERSION=1.1.1
    -ENV HADOOP_VERSION=27
    -ENV SCALA_VERSION=2.11
    +ARG FLINK_VERSION=1.1.3
    --- End diff --
    
    6e1e139 includes the note "replace ARG with ENV for backwards-compatibility".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95384182
  
    --- Diff: flink-contrib/docker-flink/Dockerfile ---
    @@ -22,9 +22,9 @@ FROM java:8-jre-alpine
     RUN apk add --no-cache bash snappy
     
     # Configure Flink version
    -ENV FLINK_VERSION=1.1.1
    -ENV HADOOP_VERSION=27
    -ENV SCALA_VERSION=2.11
    +ARG FLINK_VERSION=1.1.3
    --- End diff --
    
    The `README` says I can specify a `FLINK_VERSION` using `docker build --build-arg FLINK_VERSION=1.0.3 flink`, but that is only possible marking the variable as `ARG` and not `ENV`, see https://docs.docker.com/engine/reference/builder/#/arg


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by greghogan <gi...@git.apache.org>.
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95401803
  
    --- Diff: flink-contrib/docker-flink/Dockerfile ---
    @@ -22,9 +22,9 @@ FROM java:8-jre-alpine
     RUN apk add --no-cache bash snappy
     
     # Configure Flink version
    -ENV FLINK_VERSION=1.1.1
    -ENV HADOOP_VERSION=27
    -ENV SCALA_VERSION=2.11
    +ARG FLINK_VERSION=1.1.3
    --- End diff --
    
    This does look to be broken. @mxm what was the issue with backwards compatibility?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/3086


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95411497
  
    --- Diff: flink-contrib/docker-flink/docker-entrypoint.sh ---
    @@ -36,9 +39,9 @@ elif [ "$1" == "taskmanager" ]; then
         echo "Starting Task Manager"
         echo "config file: " && grep '^[^\n#]' $FLINK_HOME/conf/flink-conf.yaml
         $FLINK_HOME/bin/taskmanager.sh start
    +
    +  # prevent script to exit
    +  tail -f /dev/null
     else
         $@
    --- End diff --
    
    @greghogan Seems like a way to execute an arbitrary command passed inside the Docker container passed as an argument to `docker run <comand>`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    @mxm thanks :) needs there anything to be done, until this PR can be merged?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    No, looks good. Thanks. As Greg mentioned, please open a JIRA issue next time. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by greghogan <gi...@git.apache.org>.
Github user greghogan commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    For creating tickets, it's actually a requirement from Apache Legal as PR comments are then automatically added to the associated Jira which documents the contribution of the code to the project.
    
    The build is sufficiently passing. Several of the tests are unstable on TravisCI.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    @kaelumania `ARG` is only available from Docker 1.10 on and upwards. I believe docker-compose also offers to configure environment variables either through the compose file or via a command-line argument. If we refrained from `ARG`, we could keep backwards-compatibility.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    I am not sure, why the build fails as I am not deeply familiar with the Java/Scala world.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    @greghogan No, I didn't create a Ticket (sorry, I was not sure if this change justifies a Ticket). But I would love to see a Ticket about an automated build at DockerHub for Flink.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3086: Improve docker setup

Posted by kaelumania <gi...@git.apache.org>.
Github user kaelumania commented on the issue:

    https://github.com/apache/flink/pull/3086
  
    @mxn neither `docker build` nor `docker compose build` support setting environment variables from outside during the build. Further as the `docker-compose` documentation states
    > Note: If your service specifies a build option, variables defined in environment will not be automatically visible during the build. Use the args sub-option of build to define build-time environment variables.
    
    It is only possible to give arguments to the build step of `docker-compose` using the `--build-args` option, which can be interpolated with `${my_env_var}`. But still requires the `Dockerfile` to use `ARG`.
    
    Further I question the Docker version compatibility. First, flink could provide an automated build on Docker Hub. Second, one could provide a `Dockerfile.legacy` aswell.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by mxm <gi...@git.apache.org>.
Github user mxm commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95410892
  
    --- Diff: flink-contrib/docker-flink/Dockerfile ---
    @@ -22,9 +22,9 @@ FROM java:8-jre-alpine
     RUN apk add --no-cache bash snappy
     
     # Configure Flink version
    -ENV FLINK_VERSION=1.1.1
    -ENV HADOOP_VERSION=27
    -ENV SCALA_VERSION=2.11
    +ARG FLINK_VERSION=1.1.3
    --- End diff --
    
    `ARG` is only available in newer versions of Docker. If we want to maintain backwards-compatibility, we should adjust the README to state `docker build --env FLINK_VERSION=1.0.3`. As far as I know, we don't gain anything by using `ARG`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3086: Improve docker setup

Posted by greghogan <gi...@git.apache.org>.
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3086#discussion_r95382374
  
    --- Diff: flink-contrib/docker-flink/docker-entrypoint.sh ---
    @@ -36,9 +39,9 @@ elif [ "$1" == "taskmanager" ]; then
         echo "Starting Task Manager"
         echo "config file: " && grep '^[^\n#]' $FLINK_HOME/conf/flink-conf.yaml
         $FLINK_HOME/bin/taskmanager.sh start
    +
    +  # prevent script to exit
    +  tail -f /dev/null
     else
         $@
    --- End diff --
    
    How is this used?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---