[docker] cannot use runtime env with ray docker: No module named 'ray'

I built a ray docker with a dockerfile like this:

FROM rayproject/ray:2.9.1-py310-cpu
... copy requirements.txt and create an env named "production"
RUN conda create -n production --file $HOME/requirements.txt -y

To test it, I start it with docker run.
Inside the docker I do ray start --head, then open a python console to connect to it with ray.init("auto", runtime_env={"conda": "production"})

Now an arbitrary function like this

@ray.remote
def f(): pass

will fail:

(raylet) Traceback (most recent call last):
(raylet)   File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/workers/default_worker.py", line 7, in <module>
(raylet)     import ray
(raylet) ModuleNotFoundError: No module named 'ray'
(raylet) [2024-01-23 16:17:46,643 E 470 470] (raylet) worker_pool.cc:553: Some workers of the worker process(7966) have not registered within the timeout. The process is dead, probably it crashed during start.

Did I miss anything? Is this way of specifying conda env correct?
Many thanks.

I guess you created a new conda environment, but you didn’t install ray there?

Sorry for the late reply. It looks that installing ray in the new environment works.
So every time I create a new environment, I should install ray with the same version as the one in base environment, right? Will the components all work fine in this way?