Search code examples
dockerjardocker-imagetaurus

COPY into a new docker image does not work


I want to add a JAR in a new image. Whenever i build the new image with the COPY command the build passes but whenever i go to the container in bash the file is not present and my Jmeter test fails.

I want to add the tika-app-1.20.jar to my new image that is using a FROM blazemeter/taurus.

I have tried the add command.

I am building the new docker image in the directory where the jar is located.

FROM blazemeter/taurus 
COPY tika-app-1.20.jar ~/.bzt/jmeter-taurus/5.1.1/lib/

Apparently the build passes but the file is not added in the image. I have no idea why.

Thank you in advance for any help.


Solution

  • you are not creating any user so you should not try /user/myuser/test/tika-app.1.20.jar, try to ls /root/ or ls ~/ you will see the files or /root/.bzt/jmeter-taurus/5.1.1/lib/.

    Also better to better to debug using docker exec.

    docker exec -it container_name bash -c "cd ~/ && pwd && ls"
    

    This will return the about path of the file.

    which should be like /root/.bzt/jmeter-taurus/5.1.1/lib/.