uber-archive / makisu

Fast and flexible Docker image building tool, works in unprivileged containerized environments like Mesos and Kubernetes.
Apache License 2.0
2.41k stars 154 forks source link

'Makisu anywhere' bash function says Dockerfile not found #238

Closed whereisaaron closed 5 years ago

whereisaaron commented 5 years ago

Keen to test makisu, I am trying the example bash function from the README but it always says 'Dockerfile not found', even though the Dockerfile is right there. Am I missing something?

$ tail -15 ~/.bashrc
function makisu_build() {
    makisu_version=${MAKISU_VERSION:-v0.1.11}
    cd ${@: -1}
    docker run -i --rm --net host \
        -v /var/run/docker.sock:/docker.sock \
        -e DOCKER_HOST=unix:///docker.sock \
        -v $(pwd):/makisu-context \
        -v /tmp/makisu-storage:/makisu-storage \
        gcr.io/makisu-project/makisu:$makisu_version build \
            --commit=explicit \
            --modifyfs=true \
            --load \
            ${@:1:${#@}-1} /makisu-context
    cd -
}

$ ls Dockerfile
Dockerfile

$ makisu_build -t test .
{"level":"info","ts":1562517127.214381,"msg":"Starting Makisu build (version=v0.1.11)"}
{"level":"info","ts":1562517127.2148414,"msg":"Using build context: /makisu-context"}
{"level":"error","ts":1562517127.2152517,"msg":"failed to create build plan: failed to get dockerfile: failed to generate/find dockerfile in context: open /makisu-context/Dockerfile: no such file or directory"}
/home/aaron/Development/chorus-assure-build-and-deploy/build

$ bash --version
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)

$ docker --version
Docker version 18.09.0, build 4d60db4
yiranwang52 commented 5 years ago

i wonder if it's because of permission or content. @whereisaaron do you mind pasting the permission/owner and content of your dockerfile?

gaetansnl commented 5 years ago

@yiranwang52 I have the same problem on kubernetes, permission 7777. The dockerfile works with docker. I use absolute path for the dockerfile and context.

EDIT: Ok I found the problem. I used -f /dir instead of -f=/dir, a space gets added and path.Join in makisu/cmd/utils.go return wrong path....

whereisaaron commented 5 years ago

@yiranwang52 I investigated this further and I believe this is not a makisu problem. Rather is caused by a docker mounting issues when using Docker on Windows 10/WSL. I could get the function working on a pure Linux host.

Moving the Dockerfile into the Docker for Windows shared drive didn't help either. Seems like you can't have bash and be able to mount volumes at the same time 😢