Search code examples
dockerautomated-testse2e-testingweb-testingtestcafe

No permissions to create screenshot directory when using docker image testcafe/testcafe


I'm using https://hub.docker.com/r/testcafe/testcafe/

to run our Testcafe project and it works except that on failure the screenshot directory cannot be created due to:

Error: EACCES: permission denied, mkdir '/screenshots'

Is it possible to make this work, am I missing something?

I have tried:

--screenshots ./screenshots 

and:

--screenshots {full path to directory}/screenshots

How do I give access to this docker container for writing to a directory on the host machine for future reference?


Solution

  • The simplest solution is creating a screenshots directory on your Docker host, configuring correct permissions and passing this directory to the container as a volume. You can use the following commands as a reference:

    mkdir screenshots
    
    chmod a=rwx screenshots
    
    docker run -it --rm -v ./tests:/tests -v ./screenshots:/screenshots testcafe/testcafe firefox /tests --screenshots /screenshots