Access is denied when trying to build a Docker image with selenium/standalone-chrome

I’m trying to build a Dockerfile that looks like this:

FROM selenium/standalone-chrome:latest
WORKDIR /app

# Install dependencies
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
RUN pip install selenium==4.1

# Copy src contents
COPY /src /app/


# Expose the port
EXPOSE 8501

# Execution
ENTRYPOINT [ "streamlit", "run" ]
CMD ["app.py"]

However, when I execute docker build . , I get the following error:

[+] Building 0.2s (6/10)
 => [internal] load build definition from Dockerfile                                                                                                                                      0.0s 
 => => transferring dockerfile: 369B                                                                                                                                                      0.0s 
 => [internal] load .dockerignore                                                                                                                                                         0.0s 
 => => transferring context: 2B                                                                                                                                                           0.0s 
 => [internal] load metadata for docker.io/selenium/standalone-chrome:latest                                                                                                              0.0s 
 => [1/6] FROM docker.io/selenium/standalone-chrome:latest                                                                                                                                0.0s 
 => ERROR [internal] load build context                                                                                                                                                   0.0s 
 => => transferring context: 61.51kB                                                                                                                                                      0.0s 
 => CACHED [2/6] WORKDIR /app                                                                                                                                                             0.0s 
------
 > [internal] load build context:
------
error from sender: open src\dist\parser\botocore\data\chime-sdk-messaging: Access is denied.

I’ve read in the Internet that this can happen when Docker is not able to find the selenium image from the Docker Hub. However, I’ve checked, and that image is available on the Docker Hub. I’ve even been able to pull it using docker docker pull selenium/standalone-chrome . Anybody has encountered something similar or knows what is going on? Thanks in advance.

This is not about the base image but the build context.

=> ERROR [internal] load build context
error from sender: open src\dist\parser\botocore\data\chime-sdk-messaging: Access is denied.

You probably don’t have permission to read that path in the build context. If you need that, fix the permission issue. If you don’t need that, you can add it to the .dockerignore file