Create from server from Dockerfile

i Have Dockerfile like this:

FROM php:5.6.0-apache
COPY D:/www/ /var/www/html/

When i type: docker build D:\Server\php

i got a error.

Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM php:5.6.0-apache
—> 6ef297db3f99
Step 2/2 : COPY D:/www/ /var/www/html/
COPY failed: stat /var/lib/docker/tmp/docker-builder727885186/D:/www: no such file or directory

help me. please!!

from the Dockerfile doc… https://docs.docker.com/engine/reference/builder/#copy

COPY obeys the following rules:

The path must be inside the context of the build; you cannot COPY …/something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.

I think u have to use ADD instead

1 Like

ADD obeys the same rules. Also it automatically unpacks archives, which can be confusing; usually you want COPY. In any case you can never reach outside the directory tree that contains the Dockerfile, and using absolute paths like this definitely doesn’t work.

1 Like

Thank you so much. it worked.