Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to COPY files of current directory to folder in Dockerfile

I'm trying to create a Dockerfile that copies all the files in the currently directory to a specific folder.

Currently I have

COPY . /this/folder

I'm unable to check the results of this command, as my container closes nearly immediately after I run it. Is there a better way to test if the command is working?

like image 926
newmascot Avatar asked Feb 09 '16 01:02

newmascot


2 Answers

you can start a container and check.

$ docker run -ti --rm <DOCKER_IMAGE> sh
$ ls -l /this/folder

If your docker image has ENTRYPOINT setting, then run below command:

$ docker run -ti --rm --entrypoint sh <DOCKER_IMAGE>
$ ls -l /this/folder
like image 126
BMW Avatar answered Oct 17 '22 13:10

BMW


If it is only for testing, include the below command in your docker file:

RUN cd /this/folder && ls

This will list the directory contents while docker build

like image 38
Ramachandra Reddy Avatar answered Oct 17 '22 14:10

Ramachandra Reddy