MGM
MGM

Reputation: 133

COPY in Dockerfile?

I'm looking for the best way to copy a folder from a localhost to Docker container, then launch bash command inside the container?

I proceed as following instruction inside Dockerfile :

WORKDIR /workspace/
COPY /path_in_localhost /Project    
RUN ["/bin/bash", "-c", " cd /workspace/Project/ && make"]

the issue is when Docker come to the last instruction, it can find the folder, it's like the copy doesn't work?

/bin/bash: line 0: cd: /workspace/Project: No such file or directory

any suggestion ?

Upvotes: 1

Views: 1208

Answers (1)

badc0de
badc0de

Reputation: 177

If you want to take advantage of WORKDIR you need to use relative path, thus specifying Project without the / as destination.

Upvotes: 3

Related Questions