Docker Community Forums

Share and learn in the Docker community.

Yaml file issue

Hi,
I have a yaml file within python code, I use the following dockerfile for configuration

    FROM python:3
    WORKDIR .
    COPY requirements.txt ./
    RUN pip install --no-cache-dir -r requirements.txt
    COPY . .
    CMD [ "python", "./main.py" ]

The yaml file was not copied.
Any idea how to resolve this?

Best regards,

I was wondering if there is a strict policy checking on file types when adding configuration from a file.
Here’s MWE of what I encountered as errror:

import sacred
expr = sacred.Experiment(‘test-experiment’, interactive=True)
expr.add_config(‘params.yml’)
Error:

Traceback (most recent call last):
File “”, line 1, in
File “/home/user/miniconda3/envs/experiments/lib/python3.7/site-packages/sacred/ingredient.py”, line 195, in add_config
kw_conf))
File “/home/user/miniconda3/envs/experiments/lib/python3.7/site-packages/sacred/ingredient.py”, line 218, in _create_config_dict
return ConfigDict(load_config_file(abspath))
File “/home/user/miniconda3/envs/experiments/lib/python3.7/site-packages/sacred/config/config_files.py”, line 41, in load_config_file
handler = get_handler(filename)
File “/home/user/miniconda3/envs/experiments/lib/python3.7/site-packages/sacred/config/config_files.py”, line 37, in get_handler
return HANDLER_BY_EXT[extension]
KeyError: ‘.yml’

I have a configuration for my project as a yaml. Shall I change the dockerfile in order to copy the yaml into the docker image?