Why can't I use COPY in my Dockerfile

Hi !

I want to use COPY in my dockerfile but it doesn’t seem to work.

I have the error:

Step 4/5 : COPY nginx-conf /etc/nginx/conf.d
COPY failed: stat /var/lib/docker/tmp/docker-builder037741353/nginx-conf: no such file or directory

circleci configuration:

version: 2
jobs:
build:
machine: true
working_directory: ~/app

steps:

  - checkout

  - add_ssh_keys:
     fingerprints:
       - "myfingerprint"

  - run:
      name: Build NGINX image
      command: docker build - < nginx.dockerfile

Why can’t I copy/add my file ?

Docker commands run against a remote docker engine, in that context your local files do not exist so therefore you cannot copy them.

If you need to use COPY I would suggest running your build on a machine executor and use docker that way (locally).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.