TK-95
TK-95

Reputation: 1170

Copy all project. Docker file command

Just started to work with docker and I can't figure out how copy all project files into docker image?

Let's say we have structure:

----my-app

-------------------api

-------------------config

-------------------lib

-------------------public

-------------------Dockerfile

-------------------index.html

So, how can I copy all these folders and files into docker container? What command in Dockerfile should I use?

Super easy solution is to use multiple time COPY command. But I believe, that it's wrong way

Upvotes: 3

Views: 5521

Answers (3)

user2915097
user2915097

Reputation: 32176

put your files in a repository, and do a git clone or hg clone of course you will need to install git or mercurial before, and remove them after, see as an example

hub.docker.com/r/k3ck3c/simh_alpine

Upvotes: 2

Dimitrios Desyllas
Dimitrios Desyllas

Reputation: 10048

As I seen in Dockerfile documentation on COPY says:

The COPY instruction copies new files or directories from and adds them to the filesystem of the container at the path .

Therefore you can copy a whole directory.

Upvotes: 1

Mohd Asim Suhail
Mohd Asim Suhail

Reputation: 2292

docker cp command will do the work for you

docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

Upvotes: 0

Related Questions