Home > other >  Dockerfile with No such file or directory OPA throwing error
Dockerfile with No such file or directory OPA throwing error

Time:11-19

I'm trying to run dockerfile in my local and I'm getting the below error not sure why it is. I set permissions to chmod 777, still getting the error.

# Build OPA Service directory, load policies and data, install and run OPA daemon
FROM alpine:latest
RUN apk --no-cache add curl  
ADD $PWD/data /data
VOLUME /data
RUN curl -L -o opa https://openpolicyagent.org/downloads/v0.46.1/opa_darwin_amd64
RUN chmod 777 ./opa EXPOSE 8181
CMD ./opa run -s ./data --skip-version-check

Error message I'm getting as below

 => [1/5] FROM docker.io/library/alpine:latest@sha256:b95359c2505145f16c6aa384f9cc74eeff78eb36d308ca4fd902eeeb0a0  0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 97B                                                                                   0.0s
 => CACHED [2/5] RUN apk --no-cache add curl                                                                       0.0s
 => CACHED [3/5] ADD /data /data                                                                                   0.0s
 => [4/5] RUN curl -L -o opa https://openpolicyagent.org/downloads/v0.46.1/opa_darwin_amd64                        6.5s
 => ERROR [5/5] RUN chmod 777 ./opa EXPOSE 8181                                                                    0.8s
------                                                                                                                  
 > [5/5] RUN chmod 777 ./opa EXPOSE 8181:                                                                               
#9 0.823 chmod: EXPOSE: No such file or directory                                                                       
#9 0.823 chmod: 8181: No such file or directory                                                                         
------
executor failed running [/bin/sh -c chmod 777 ./opa EXPOSE 8181]: exit code: 1

I tried to follow the steps listed, https://aws.amazon.com/blogs/opensource/deploying-open-policy-agent-opa-as-a-sidecar-on-amazon-elastic-container-service-amazon-ecs/ and for some reason I'm not able to bypass this error.

CodePudding user response:

RUN chmod 777 ./opa EXPOSE 8181

This looks odd. Can you try making it two lines?

RUN chmod 777 ./opa
EXPOSE 8181

Also, the ./opa binary should already be executable, so there's no need to chmod it.

  • Related