Timeout error when running webdriverIO project in Docker with MacBook M1 Pro

49 Views Asked by At

I have a project built with webdriverIO working fine in my local machine.

After I build the docker image using dockerfile and run in docker, chromedriver starts but an error timeout is thrown.

How I build the image using the following Dockerfile -> docker build --platform linux/amd64 -t {name:tag} .

# Usar una imagen base de Node.js
FROM node:18

# Actualizar el índice de paquetes e instalar dependencias necesarias
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    gnupg \
    ca-certificates \
    fonts-liberation \
    libappindicator3-1 \
    libasound2 \
    libatk-bridge2.0-0 \
    libatk1.0-0 \
    libcups2 \
    libdbus-1-3 \
    libdrm2 \
    libgbm1 \
    libglib2.0-0 \
    libgtk-3-0 \
    libnspr4 \
    libnss3 \
    libx11-xcb1 \
    libxcomposite1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxrandr2 \
    xdg-utils \
    --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# Descargar e instalar Google Chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
    && apt-get update \
    && apt-get install -y google-chrome-stable

# Configurar variables de entorno para Chrome
ENV CHROME_BIN /usr/bin/google-chrome

# Establecer la zona horaria para evitar problemas con algunas aplicaciones
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Establecer un directorio de trabajo
WORKDIR /app

# Copiar los archivos de la aplicación dwio al contenedor (Asegúrate de ajustar la ruta según tu estructura de archivos)
COPY package.json package-lock.json ./

# Instalar las dependencias de Node.js
# RUN npm install wdio-docker-service --save-dev
RUN npm install

COPY . .

# Comando por defecto para iniciar la aplicación
CMD npm run wdio

How I run the image -> docker run --platform linux/amd64 -it {name:tage}

This is working fine in Docker in a windows machine x86, but in mac m1 is failing with the following error: Timeout error after chromedriver starts

0

There are 0 best solutions below