indigo-dc / udocker

A basic user tool to execute simple docker containers in batch or interactive systems without root privileges.
https://indigo-dc.github.io/udocker/
Apache License 2.0
1.38k stars 135 forks source link

Error when loading a docker image #381

Open emedernach opened 1 year ago

emedernach commented 1 year ago

Hello,

We are trying to load a docker image and we obtain this error:

$ udocker --version
version: 1.3.5

$ udocker load -i Simple.tgz Simple
Traceback (most recent call last):
  File ".../udocker", line 64, in <module>
    main()
  File ".../udocker", line 42, in main
    exit_status = UMain(sys.argv).execute()
  File ".../umain.py", line 107, in execute
    exit_status = cmds[command](self.cmdp)  # executes command
  File ".../cli.py", line 308, in do_load
    repos = self.localfileapi.load(imagefile, imagerepo)
  File ".../localfile.py", line 36, in load
    self.localrepo).load(tmp_imagedir, imagerepo)
  File ".../docker.py", line 758, in load
    repositories = self._load_repositories(structure)
  File ".../docker.py", line 741, in _load_repositories
    loaded_repo = self._load_image(structure, imagerepo, tag)
  File ".../commonlocalfile.py", line 67, in _load_image
    return self._load_image_step2(structure, imagerepo, tag)
  File ".../docker.py", line 714, in _load_image_step2
    json_file = structure["repoconfigs"][json_config_file]["json_f"]
KeyError: 'config.json'

Our image is generated with Guix. Here is a minimal image with this error: Simple.tgz

Best regards,

Medernach Emmanuel

emedernach commented 1 year ago

Hello,

We managed to solve the problem by modifying the _load_structure method (in docker.py line 631):

            # elif len(fname) >= 69 and fname.endswith(".json"):
            elif fname.endswith(".json"):

Best regards,

Medernach Emmanuel

emedernach commented 1 year ago

Hello,

The issue is still there when we use 'import' but it works with 'load', you could test it with this docker image:

Minimal Docker Image with /bin/bash

** With udocker import

# udocker import Bash-02Feb2023.tar.gz Bash-02Feb2023
# udocker create --name=test-02Feb2023 Bash-02Feb2023
# udocker ps
...
4a707804-5305-3fc7-bc82-6f9ced83296d . W ['test-02Feb2023'] Bash-02Feb2023:latest
# udocker run 4a707804-5305-3fc7-bc82-6f9ced83296d /bin/bash
Error: command not found or has no execute bit set:  ['/bin/bash']

** With udocker load

# udocker load -i Bash-02Feb2023.tar.gz Bash-02Feb2023-loaded
# udocker create --name=test-02Feb2023-loaded Bash-02Feb2023-loaded
fa3e6205-3969-3353-94ec-237339b3138b
# udocker run fa3e6205-3969-3353-94ec-237339b3138b /bin/bash

 ******************************************************************************
 *                                                                            *
 *               STARTING fa3e6205-3969-3353-94ec-237339b3138b                *
 *                                                                            *
 ******************************************************************************
 executing: bash

Best regards,

Medernach Emmanuel

jorge-lip commented 1 year ago

If you can please post again the tar files. Thanks !

emedernach commented 1 year ago

Hello,

Here is a docker image (Simple.tgz):

https://filesender.renater.fr/?s=download&token=2ce8811a-39ca-4565-858f-b96d84669e87

jorge-lip commented 8 months ago

This should be fixed, if the problem persists please let us know.