Docker Remote API versus CLI - cannot find files

hello.

I’m trying to interact with the Docker API in a very basic way.

I have a simple Dockerfile.

FROM node:5.8.0 COPY . /my-project WORKDIR /my-project RUN npm install CMD ["node", "server.js"]

from my terminal when i do docker build .

my build is successful and all npm modules are installed. i can then subsequently do a docker run

However when I attempt to do the exact same thing using the Docker Remote API.

Where my file structure is

–Dockerfile
–dfile.tar
–package.json
–server.js

curl \ --cacert $DOCKER_CERT_PATH/ca.pem \ --cert $DOCKER_CERT_PATH/cert.pfx --pass supersecret \ -v -X POST -H "Content-Type:application/tar" --data-binary '@dfile.tar' https://192.168.99.100:2376/build

It seems that nothing is copied over and it cannot find package.json. I get the below error. I am not sure what I am missing. Any help is appreciated.

{"stream":"Step 4 : RUN npm install\n"} {"stream":" ---\u003e Running in f2c8dd537a84\n"} {"stream":"\u001b[91mnpm info it worked if it ends with ok\nnpm info using npm@3.7.3\nnpm info using node@v5.8.0\n\u001b[0m"} {"stream":"\u001b[91mnpm info lifecycle undefined~preinstall: undefined\nnpm info linkStuff !invalid#1\nnpm info lifecycle undefined~install: undefined\n\u001b[0m"} {"stream":"\u001b[91mnpm info lifecycle undefined~postinstall: undefined\n\u001b[0m"} {"stream":"\u001b[91mnpm info lifecycle undefined~prepublish: undefined\nnpm WARN enoent ENOENT: no such file or directory, open '/my-project/package.json'\nnpm WARN my-project No description\nnpm WARN my-project No repository field.\nnpm WARN my-project No README data\nnpm WARN my-project No license field.\nnpm info ok \n\u001b[0m"}

Do you have the contents of package.json and server.js? I am guessing that the dfile.tar is just these three files tar’d up together?

I’d like to try to reproduce this locally.

human error. i didn’t actually have these files in the dfile.tar. seems obvious now. a bit of a noob to docker and the docker remote api. appreciate the quick response!