I am trying to create an Image from the Dockerfile.
# cat Dockerfile
FROM ubuntu:16.04
COPY $pwd/intel_virtual_gateway_console64_1_9_0.tar /root/
COPY $pwd/login.exp /root/
RUN cd /root
RUN echo $PWD
RUN tar -xvf intel_virtual_gateway_console64_1_9_0.tar
RUN cd virtualgatewayconsole_package
RUN apt-get update && apt-get install expect \
expect-dev
While building the Image the directory is not getting changed to /root/. I thought the issue could be the tar file is missing, in order to confirm that printing the current working directory after the changing it to /root directory.But I have verified in the container that the packages were successfully copied to the /root directory. I have even verified by experimenting with other directories as well, even for those the directory is not getting changed. Due to this issue the consequent steps are failing:
# docker build -t release:1.0 .
Sending build context to Docker daemon 633.2MB
Step 1/8 : FROM ubuntu:16.04
---> 6a2f32de169d
Step 2/8 : COPY $pwd/intel_virtual_gateway_console64_1_9_0.tar /root/
---> Using cache
---> 36e9ea407082
Step 3/8 : COPY $pwd/login.exp /root/
---> Using cache
---> 578f9f9481d9
Step 4/8 : RUN cd /root
---> Running in 07ccfc507888
---> ad60f9d31c7e
Removing intermediate container 07ccfc507888
Step 5/8 : RUN echo $PWD
---> Running in e0ec2df6a0dc
/
---> 979a42368814
Removing intermediate container e0ec2df6a0dc
Step 6/8 : RUN tar -xvf intel_virtual_gateway_console64_1_9_0.tar
---> Running in 0701db595e27
tar: intel_virtual_gateway_console64_1_9_0.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
The command '/bin/sh -c tar -xvf intel_virtual_gateway_console64_1_9_0.tar' returned a non-zero code: 2
But able to change the directory within the container.
# docker run -it 979a42368814 /bin/bash
root@100b02ddc98a:/# pwd
/
root@100b02ddc98a:/# cd /root/
root@100b02ddc98a:~# pwd
/root
Please help to find out what is causing the issue.