pangeo-data/pangeo-stacks

trying to use onbuild with binder, error "unknown flag: chown"

Opened this issue · 6 comments

I'm trying out the new onbuild stuff in this repo:
https://github.com/rabernat/local_stencil_ml_examples

My Dockerfile looks like this

FROM pangeo/pangeo-notebook-onbuild:2019.04.19

# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html#preparing-your-dockerfile
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/${NB_USER}

COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}

I got this error.

Waiting for build to start...
/usr/local/lib/python3.7/site-packages/repo2docker/utils.py:214: FutureWarning: Possible nested set at position 1815
  """, re.VERBOSE)
Picked Git content provider.
Cloning into '/tmp/repo2docker_8lb8bku'...
HEAD is now at fce01c6 first commit
Using DockerBuildPack builder
Step 1/8 : FROM pangeo/pangeo-notebook-onbuild:2019.04.19
# Executing 5 build triggers...
Step 1/1 : COPY --chown=1000:1000 . ${REPO_DIR}
Unknown flag: chown

I'm going to try removing all the extra docker stuff.

After updating the Dockerfile, I am still getting the same error

Waiting for build to start...
/usr/local/lib/python3.7/site-packages/repo2docker/utils.py:214: FutureWarning: Possible nested set at position 1815
  """, re.VERBOSE)
Picked Git content provider.
Cloning into '/tmp/repo2dockerlo7vr772'...
HEAD is now at 2ce06d5 removed crap from Dockerfile
Using DockerBuildPack builder
Step 1/1 : FROM pangeo/pangeo-notebook-onbuild:2019.04.19
# Executing 5 build triggers...
Step 1/1 : COPY --chown=1000:1000 . ${REPO_DIR}
Unknown flag: chown

I think you need a newer version of docker - —chown was added a few years ago. We can also make the onbuild variants not use it if we wanna support older versions of docker. If this is on Pangeo binder I think it should be fixed by the dind work @jhamman is doing. Can you try on mybinder.org to see if it works there?

Also you only need the FROM line and nothing more when using the onbuild variants.

#37 removes --chown so the onbuild variants will be compatible with older docker versions.

I think rabernat/local_stencil_ml_examples#1 fixes it. It works on mybinder.org with this - https://mybinder.org/v2/gh/yuvipanda/local_stencil_ml_examples/master. Once #37 lands and we use that as base image, it should work on pangeo binder too.

@rabernat - I've updated the docker version on pangeo-binder so your original onbuild example should work now.