Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker helper: version not being obtained #359

Open
dfdan opened this issue Aug 22, 2023 · 4 comments
Open

docker helper: version not being obtained #359

dfdan opened this issue Aug 22, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@dfdan
Copy link
Member

dfdan commented Aug 22, 2023

Package version (if known): 1.1.0

Describe the bug

With docker 20.10 / docker-compose 1.25.0 (ubuntu 20.04) the docker helper is trying to run 'docker compose' but this command isn't available. It should still be docker-compose in this case.

This causes docker not to be able to start services etc when the helper fails here:

dc_version = groups.group(0)

Steps to Reproduce

Bootstrap instance with Docker 20.10 (as packaged in Ubuntu 20.04), bootstrap an instance of ~12 and try to start services.

Expected behavior

services should start

Screenshots (if applicable)

(rdm12a) dan@id23:~/test2/rdm12a$ invenio-cli services setup
Traceback (most recent call last):
  File "/home/dan/.venv/rdm12a/bin/invenio-cli", line 33, in <module>
    sys.exit(load_entry_point('invenio-cli', 'console_scripts', 'invenio-cli')())
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/dan/.venv/rdm12a/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/dan/test2/invenio-cli/invenio_cli/cli/services.py", line 65, in setup
    commands = ServicesCommands(cli_config)
  File "/home/dan/test2/invenio-cli/invenio_cli/commands/services.py", line 29, in __init__
    self.docker_helper = docker_helper or DockerHelper(
  File "/home/dan/test2/invenio-cli/invenio_cli/helpers/docker_helper.py", line 29, in __init__
    self.container_prefix = self._normalize_name(project_shortname)
  File "/home/dan/test2/invenio-cli/invenio_cli/helpers/docker_helper.py", line 41, in _normalize_name
    dc_version = groups.group(0)
AttributeError: 'NoneType' object has no attribute 'group'

Additional context

@dfdan dfdan added the bug Something isn't working label Aug 22, 2023
@ghost
Copy link

ghost commented Aug 22, 2023

I can confirm for debian - we had the same issue, which forced me to upgrade to a newer docker version.
When checking the system-requirements with invenio-cli they failed due to docker.

In case that this is wanted behaviour due to end of life of the old docker version: we might want to adjust the documentation: https://inveniordm.docs.cern.ch/install/requirements/

@ptamarit
Copy link
Member

ptamarit commented Oct 9, 2023

EDIT: There are in fact two problems: the first one (described below) is related with obtaining the version of Docker. The second one is about obtaining the version of Docker Compose failing on environments where the command is docker-compose instead of docker compose (what is described above).

I am using Docker 20.10.22 (the minimum required Docker version for InvenioRDM is 20.10.10+ according to the documentation), and I am facing the same problem .

This is due to the fact that the command used in the requirements.py does return json instead of the expected version with Docker 20:

$ docker version --format json
json

The official Docker documentation mentions the value 'json' for the --format option , but later on an example shows the syntax docker version --format '{{json .}} to output JSON and this syntax works with Docker 20.

However, the best solution in our case which works will all versions would be to follow the examples on how to extract specific information, which is a much simpler since it does not require any JSON parsing:

$ docker version --format '{{.Client.Version}}'
20.10.22

I can create a pull request with this change if you want.

@dfdan
Copy link
Member Author

dfdan commented Oct 11, 2023

@ptamarit Thanks for looking into this. We love PR's...

@RoHei
Copy link

RoHei commented Feb 29, 2024

Hi all, is there anything new on this issue? Currently users are running into this, see: https://invenio-talk.web.cern.ch/t/installation-error-of-invenio-rdm-in-local-machine-please-solve/351.

In my case, I ran into the second error mentioned by @ptamarit. So I just changed the code in docker_helper.py locally from:
self.docker_compose = ["docker", "compose"]
to:
self.docker_compose = ["docker-compose"]

But this is clearly not a good workaround for all systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants