containers / buildah

A tool that facilitates building OCI images.
https://buildah.io
Apache License 2.0
7.41k stars 783 forks source link

error ensuring container path "/opt/app" #2198

Closed ahmedwaleedmalik closed 4 years ago

ahmedwaleedmalik commented 4 years ago

Hi, I am trying to build a docker image using buildah but i am getting this error:

STEP 1: FROM gcr.io/distroless/java:8
Getting image source signatures
Copying blob sha256:3e010093287c245d72a774033b4cddd6451a820bfbb1948c97798e1838858dd2
Copying blob sha256:69e2f037cdb30c8d329b17dad42cd9d92a45d93c17e6699650b23c55eceacb5f
Copying blob sha256:24f0c933cbef83faee52f82c7f889c727b1ece5123b92d036c52fa865480f037
Copying blob sha256:3fd465e952b2f6c40f597a846d4ff4a4e6369518fc136cc507f86a912f7c4c4e
Copying config sha256:d64c805c76dc56569725ce468227f6b6b142e8d35761b012f57c7dfe6eccb418
Writing manifest to image destination
Storing signatures
6d24e1189b76eecabccc958c763cc30009ec3b190d2af7ff597e4cb8c4986161
STEP 2: USER 1001
d5d1050e5dc814067e0a6a038231085f45f78839596c60fa70a48bd3fd09b8ad
STEP 3: ENV HOME=/opt/app
e70a7b6186c4219ed385a0083840255313e8704a37bfd7293f22652e8716ea56
STEP 4: WORKDIR $HOME
error building at STEP "WORKDIR $HOME": error ensuring container path "/opt/app": lstat /var/lib/containers/storage/overlay/ee028ed9fc1d179c87b43bd4c5699ac3646327a884e4522c31a560c503d1c42b/merged/opt: invalid argument

DockerFile:

FROM gcr.io/distroless/java:8

USER 1001

ENV HOME=/opt/app
WORKDIR $HOME

# Expose the port on which your service will run
EXPOSE 8080

# NOTE we assume there's only 1 jar in the target dir
COPY target/*.jar $HOME/artifacts/app.jar

CMD ["artifacts/app.jar"]

I am trying to build the image in a tekton(openshift) pipeline. Using quay.io/buildah/stable with the following command: ['buildah', 'bud', '--tls-verify=$(inputs.params.tlsVerify)', '--layers','-f', '/workspace/source/dockerFile', '-t', '$(inputs.params.destinationImageName)', '.']

ahmedwaleedmalik commented 4 years ago

Adding --storage-driver=vfs in the build command fixed this issue for me :)

gregoryboue commented 4 years ago

I hit the same issue with buildah/stable:v1.14.8 in openshift container platform v3.11.104 whereas on AKS cluster it works fine.

Use vfs driver is not a solution for me because the buildah bud performance are increased by 10.

There is another way to handle it on openshift ?

rhatdan commented 4 years ago

Can you run the container with privs? Basically as root? Or at least with CAP_SETUID, CAP_SETGID?

gregoryboue commented 4 years ago

@rhatdan yes i'm running container with privileged : true and as root

rhatdan commented 4 years ago

I think the issue is the /dev/fuse is not being added by default to the container, so the container is not using fuse-overlayfs.

rhatdan commented 4 years ago

@haircommander FYI