Cannot dockerize a python chess game

I’m facing an issue while building a Docker image using a Dockerfile. I have a directory named “shatranj” that contains two Python files ( and and several PNG files. The goal is to include these files in the Docker image and run the chess game within a container.

However, when I execute the docker build command with the Dockerfile, I encounter the following error message:

Step 3/5 : COPY shatranj /app/
COPY failed: file not found in build context or excluded by .dockerignore: stat shatranj: file does not exist

I have verified the following:

  1. Directory structure: The “shatranj” directory is located in the same directory as the Dockerfile, and it contains all the necessary files (,, and PNG files).
  2. Build context: I am executing the docker build command from the correct directory, which includes both the Dockerfile and the “shatranj” directory.
  3. .dockerignore file: I don’t have a .dockerignore file in the build context, so there shouldn’t be any files excluded.

Here’s an excerpt from my Dockerfile:

FROM python:3.9


COPY shatranj /app/
RUN pip install pygame
CMD [“python”, “shatranj/”]

I have tried modifying the COPY command to include the relative path from the build context (COPY ../shatranj /app/ ), but the issue persists.

Have you tried changing

COPY shatranj /app


COPY . /app

That way you can find out what the actual context is since it will be copied to the /app folder.

As we have no idea how your exact docker build command and your folder structure looks like, we can only guess what needs to be done.

Please try what @rimelek suggested, and if you encounter further problems, please share the exact docker build command used to build the image (but please do not obfuscate anything else than the tag), and the output of ls -lR, so we can see the actual folder structure.