Docker Community Forums

Share and learn in the Docker community.

Create from server from Dockerfile

(Dovanmanh080485) #1

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!!

(Sam) #2

from the Dockerfile doc…

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

(David Maze) #3

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.

(Dovanmanh080485) #4

Thank you so much. it worked.