Skip to content

GSC build fails with KeyError: 'User' with the latest docker version. #243

@KiranSukhavasi

Description

@KiranSukhavasi

Description of the problem and the error:
Recently we have upgraded our infra and with the latest docker version on RHEL image we see below error during gsc build.

Error:

$ ./gsc build --insecure-args python:bullseye test/generic.manifest
Building unsigned graminized Docker image `gsc-python:bullseye-unsigned` from original application image `python:bullseye`...
Traceback (most recent call last):
  File "/home/intel/kiran/gsc/./gsc", line 12, in <module>
    sys.exit(main(sys.argv))
  File "/home/intel/kiran/gsc/./gsc.py", line 748, in main
    return args.command(args)
  File "/home/intel/kiran/gsc/./gsc.py", line 371, in gsc_build
    extract_user_from_image_config(original_image.attrs['Config'], env)
  File "/home/intel/kiran/gsc/./gsc.py", line 161, in extract_user_from_image_config
    user = config['User']
**KeyError: 'User'**

Steps to reproduce:
On any RHEL 9 distro, update to the latest docker version, clone the gsc repo with master branch and as per the steps mentioned in the doc (https://gramine.readthedocs.io/projects/gsc/en/latest/), try to execute the following commands under gsc folder to reproduce the above reported error.
1.) cp config.yaml.template config.yaml
2.) openssl genrsa -3 -out enclave-key.pem 3072
3.) docker pull python:bullseye
4.) ./gsc build --insecure-args python:bullseye test/generic.manifest

Expected results:
No errors while parsing the config keywords and we should be able to build the gsc image successfully.

Suggestion:
In the gsc.py, if we update the fetching of the Keywords as below, the issue might get resolved and this has to be updated for few other Keywords in the gsc.py file,
user = config['User'] -> user = config.get('User')

Same fix is needed for the other keywords like entrypoint, workdir and cmd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions