September 2018
Intermediate to advanced
764 pages
20h 6m
English
Next, we need to copy in our project code into our container. We will use the COPY instruction, which has the following signature:
COPY [--chown=<user>:<group>] <src>... <dest>
src is the path on the host machine where files will be copied from. The src path will be resolved against the context, which is a directory we can specify when we run docker build.
dest is the path inside the container where the files are to be copied to. The dest path can be either absolute or relative. If relatively, it will be resolved against the WORKDIR.
Below the FROM instruction, add a WORKDIR and COPY instruction:
WORKDIR /root/ COPY . .
This simply copies all the files from the context to the /root/ inside the container.
Read now
Unlock full access