osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
584 stars 75 forks source link

Extension volume doesn't support default arguments. Please extend it. #287

Closed AndreasAZiegler closed 2 months ago

AndreasAZiegler commented 2 months ago

I just noticed that the rocker command I usually use

TERM=xterm rocker --x11 --user --home --privileged --env TERM=xterm --name ros-dev --volume /dev/bus/usb:/dev/bus/usb --volume /data:/data --network=host  -- table-tennis-ros2

is now throwing the error

Extension volume doesn't support default arguments. Please extend it.
Active extensions ['env', 'home', 'name', 'network', 'privileged', 'volume', 'x11', 'user']
Traceback (most recent call last):
  File "/usr/bin/rocker", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/rocker/cli.py", line 64, in main
    dig = DockerImageGenerator(active_extensions, args_dict, base_image)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/rocker/core.py", line 209, in __init__
    self.dockerfile = generate_dockerfile(active_extensions, self.cliargs, base_image)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/rocker/core.py", line 348, in generate_dockerfile
    dockerfile_str += el.get_snippet(args_dict) + '\n'
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/rocker/extensions.py", line 298, in get_snippet
    return em.expand(snippet, substitutions)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 5961, in expand
    result = interp.expand(data, locals, name, dispatcher=None)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 4681, in expand
    self.string(data, locals, dispatcher)
  File "/usr/bin/em.py", line 4830, in string
    while not self.safe(scanner, True, locals, dispatcher):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 4862, in safe
    if dispatcher():
       ^^^^^^^^^^^^
  File "/usr/bin/em.py", line 4843, in safe
    return self.parse(scanner, locals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 4870, in parse
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 3999, in one
    token.scan(self)
  File "/usr/bin/em.py", line 2648, in scan
    self.subscan(scanner, self.type)
  File "/usr/bin/em.py", line 2664, in subscan
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 3999, in one
    token.scan(self)
  File "/usr/bin/em.py", line 2648, in scan
    self.subscan(scanner, self.type)
  File "/usr/bin/em.py", line 2664, in subscan
    token = scanner.one()
            ^^^^^^^^^^^^^
  File "/usr/bin/em.py", line 3995, in one
    raise ParseError("unknown markup sequence: `%s%s`%s" % (self.config.prefix, first, self.factory.addendum(first)))
em.ParseError: unknown markup sequence: `@((`; extension markup `@((...))` invoked with no installed extension

There was a docker update vom 1:27.2.0-1 to 1:27.2.1-1 which I assume causes the troubles but I'm not sure.

tfoote commented 2 months ago

The deprecation warning at the top about the volume extension default arguments is not the error you're seeing. I opened a PR for fixing that in #288

This looks like an empy parsing issue. Do you have a new version of empy what installation mechanism are you using?

Can you reduce the number of arguments and use a standard image like ubuntu to reproduce the issue?