'Dockerfile : Current path and its contents
I added a new opentelemetry-javaagent.jar to my home folder, the jar is in the same location as installPackages.sh file.
FROM local_repo:ubuntu
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=$TZ
RUN pwd && ls -l
COPY ./installPackages.sh /tmp/
COPY ./opentelemetry-javaagent.jar /tmp/opentelemetry-javaagent.jar
However, when the ls -l command is executed I don't see any of these files. The output is:
Step 4/18 : RUN pwd && ls -l
---> Running in dcc4cae7e26c
/
total 48
lrwxrwxrwx 1 root root 7 Oct 6 16:47 bin -> usr/bin
drwxr-xr-x 2 root root 4096 Apr 15 2020 boot
drwxr-xr-x 5 root root 340 Mar 22 21:15 dev
drwxr-xr-x 1 root root 4096 Mar 22 21:14 etc
drwxr-xr-x 2 root root 4096 Apr 15 2020 home
lrwxrwxrwx 1 root root 7 Oct 6 16:47 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Oct 6 16:47 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 Oct 6 16:47 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 Oct 6 16:47 libx32 -> usr/libx32
drwxr-xr-x 2 root root 4096 Oct 6 16:47 media
drwxr-xr-x 2 root root 4096 Oct 6 16:47 mnt
drwxr-xr-x 2 root root 4096 Oct 6 16:47 opt
dr-xr-xr-x 939 root root 0 Mar 22 21:15 proc
drwx------ 2 root root 4096 Oct 6 16:58 root
drwxr-xr-x 5 root root 4096 Oct 6 16:58 run
lrwxrwxrwx 1 root root 8 Oct 6 16:47 sbin -> usr/sbin
drwxr-xr-x 2 root root 4096 Oct 6 16:47 srv
dr-xr-xr-x 13 root root 0 Mar 22 21:15 sys
drwxrwxrwt 2 root root 4096 Oct 6 16:58 tmp
drwxr-xr-x 13 root root 4096 Oct 6 16:47 usr
drwxr-xr-x 1 root root 4096 Oct 6 16:58 var
Removing intermediate container dcc4cae7e26c
1 Shouldn't I be seeing the files I am copying upon ls -l?
[2] The error I get copying opentelemetry jar is
COPY failed: file not found in build context or excluded by .dockerignore: stat opentelemetry-javaagent.jar: file does not exist
I have not created a dockerignore file explicitly so it must be the default value.
Snapshot of the directory structure, both installPackages and the jar is present at the same path. If one is getting copied, the other one should too?

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
