Remote Job Posting at Mercor for Software Engineer which needs Python and Docker as Skill set.
Welcome to the interview! Please make sure your entire screen is shared for the duration of the interview, or we will not be able to consider your application.
Process
Read this document carefully.
Please make sure your entire screen is shared for the duration of the interview, or we will not be able to consider your application. Return to the Mercor interview page and share your screen if you are not already doing so.
Download the provided Dockerfiles (Dockerfile.base and Dockerfile.candidate)
Run the setup steps below
Complete the task below
Complete the interview and make sure to upload your completed Dockerfile.candidate after the interview per the Submission instructions.
Don't have Docker installed? See here.
Overview
You will set up a Python environment for a 2019 commit in the Black repository.
You are given an incomplete Dockerfile called Dockerfile.candidate which creates an empty Conda environment testbed.
Edit Dockerfile.candidate so the Conda environment testbed can run pytest tests/test_black.py.
Setup
Provided are two Dockerfiles:
Dockerfile.base - This is for documentation purposes. We’ve built and hosted this for you, your Dockerfile.candidate extends this base image.
Dockerfile.candidate - You will submit this Dockerfile. It extends the base image and creates an empty Conda environment named testbed.
Build Dockerfile.candidate and start a shell inside it:
docker build --no-cache -t mercor_interview:latest -f Dockerfile.candidate . && docker run -it mercor_interview:latest /bin/bash
The container already has Black at the correct commit, so you can immediately begin working on setting up the Conda environment.
Optionally, if you want to view the container’s files on your machine versus inside the container’s shell, you can copy over the files by running this in your machine’s terminal:
docker cp $(docker create mercor_interview:latest):/Mercor_Interview .
Task
Write Conda command(s) in Dockerfile.candidate that sets up the Conda environment testbed so pytest tests/test_black.py
can run successfully.
For experimentation first, you can use the container's shell to try different commands. Once you have the correct command(s), add them to Dockerfile.candidate
.
All 100 tests must pass. No tests can skip or fail. Warnings are allowed.
Hints
Ensure the correct versions are installed for Python and dependencies
The base image already provides Conda and has cloned the correct version of black
Rules
Only edit Dockerfile.candidate. DO NOT edit Dockerfile.base or black repository files
Only use Conda. DO NOT use poetry, uv, etc.
You can reference the internet but NOT LLMs or LLM tools like ChatGPT, Cursor, etc.
You must keep your entire screen shared at all times, or we cannot evaluate your interview.
Submission
Once you finish the task, end the Mercor interview. Once you click "end" on the interview, you will be automatically directed to the next step of the application, where you must upload your completed Dockerfile.candidate .
If you are retaking this interview, please submit your Dockerfile at this Google Form.
Evaluation
Our auto grader will build your Dockerfile.candidate and run the following commands inside it:
Activate your Conda environment testbed
Run
pytest tests/test_black.py
Therefore, your Dockerfile.candidate must:
Create a Conda environment named testbed (which it starts with)
Set up the appropriate Python version, dependencies, and environment variables
NOT try to clone or set up the black repository (this is already done in the base image)
NOT run pytest tests/test_black.py itself
Docker FAQs
To resolve the "cannot connect to the Docker daemon" error, ensure the Docker daemon is running, check user permissions, verify Docker Desktop settings, and potentially switch to the default Docker context or troubleshoot network connectivity issues
Solution
Dockerfile.candidate
FROM public.ecr.aws/v2q4q9u9/mercor-black-base:latest
#======================================================================
# TODO: Install the correct version of Python and black's dependencies
# inside a conda environment named `testbed`. Ensure all 100 tests pass
# with `pytest tests/test_black.py`.
RUN conda create -n testbed python
# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "testbed", "/bin/bash", "-c"]
RUN conda install -c conda-forge pytest
RUN conda install -c conda-forge click -y
RUN conda install -c conda-forge black
RUN pytest tests/test_black.py
#======================================================================
WORKDIR /Mercor_Interview