Docker images that include all operating system dependencies necessary to run Cypress, but NOT Cypress itself and no pre-installed browsers. See cypress/included images if you need Cypress pre-installed in the image. See cypress/browsers images if you need some browsers pre-installed in the image.
cypress/base images on Cypress on Docker Hub use image tags in the form:
<node version>
latest
for example:
cypress/base:20.14.0
cypress/base:latest
To avoid unplanned breaking changes, specify a fixed <node version>
tag, not the latest
tag.
The latest
tag is linked to the latest released cypress/base
image for the Node.js Active LTS version and is updated without notice.
When running a container from a cypress/base
image, bash
is executed, as defined by the CMD parameter of the image.
In this example we first run the unchanged image cypress/base
as a container:
cd examples/basic # Use a pre-configured simple Cypress E2E project
npm ci # Install Cypress
docker run -it --rm -v .:/app -w /app cypress/base # Run image as container
At the bash
prompt :/app#
, we can then enter the following commands:
npx cypress install # Install Cypress binary into running Docker container
npx cypress run # Run Cypress test
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