Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGTRAP "Fontconfig error: No writable cache directories" with non-root user not node (1000) #1275

Open
MikeMcC399 opened this issue Jan 7, 2025 · 1 comment

Comments

@MikeMcC399
Copy link
Collaborator

Issue

If an attempt is made to run a Cypress Docker image using a non-root user that is not node (1000) then Cypress fails with:

Fontconfig error: No writable cache directories
The Test Runner unexpectedly exited via a exit event with signal SIGTRAP

This affects all Cypress Docker images (cypress/base, cypress/browsers, cypress/included & custom images generated from cypress/factory).

Note that GitHub Actions solves this issue exceptionally for user 1001 by mounting a separate writable /github/home directory and passing a HOME environment variable pointing to it.

Steps to reproduce

Ubuntu 24.04.1 LTS, Node.js 22.12.0 LTS, Docker Desktop 4.37.1, cypress/base.

Follow the instructions in Docker build and run for cypress/base as below:


In this example we use a customized Dockerfile which bases a new image on cypress/base, copies the complete Cypress project into the image, including installed dependencies, then installs the Cypress binary.

The file is examples/basic/Dockerfile.base and it has the following contents:

FROM cypress/base
COPY . /opt/app
WORKDIR /opt/app
RUN npx cypress install # Install Cypress binary into image

We build the new image, run the container from the image and execute the Cypress command npx cypress run to run the test:

cd examples/basic         # Use a pre-configured simple Cypress E2E project
npm ci                    # Install Cypress
docker build . -f Dockerfile.base -t test-base  # Build a new image
docker run -it --rm --entrypoint bash test-base -c "npx cypress run" # Run Cypress test in container

After confirming that the image can be run with the above docker run command, substitute the following command, which fails:

docker run -it --rm --env CYPRESS_SKIP_VERIFY=true --entrypoint bash --user 1001 test-base -c "npx cypress run"

Logs

$ docker run -it --rm --entrypoint bash --env CYPRESS_SKIP_VERIFY=true --user 1001 test-base -c "npx cypress run" # Run Cypress test in container
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
Fontconfig error: No writable cache directories
The Test Runner unexpectedly exited via a exit event with signal SIGTRAP

Please search Cypress documentation for possible solutions:

https://on.cypress.io

Check if there is a GitHub issue describing this crash:

https://github.com/cypress-io/cypress/issues

Consider opening a new issue.

----------

Platform: linux-x64 (Debian - 12.8)
Cypress Version: 13.17.0

Other

@MikeMcC399
Copy link
Collaborator Author

A possible workaround is to make the configured /home/node writable for all users:

Workaround

Copy examples/basic/Dockerfile.base to Dockerfile.base.wa and modify the file as follows:

FROM cypress/base
COPY . /opt/app
WORKDIR /opt/app
RUN npx cypress install
RUN chmod -R 777 /home/node
ENV HOME=/home/node
ENV CYPRESS_SKIP_VERIFY=true
cd examples/basic
npm ci
docker build -f Dockerfile.base.wa -t test-base-wa .
docker run -it --rm --entrypoint bash --user 1001 test-base-wa -c "npx cypress run"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant