Page MenuHomeVyOS Platform

Add “command” and “arg” configuration options for containers
Closed, ResolvedPublicFEATURE REQUEST

Description

Containers may require additional arguments when run, both to specify the command and/or additional arguments. This is implemented in podman as follows:

podman container run [options] image [command [arg …]]

VyOS does not yet support these additional arguments, it would be great if they could be implemented as additional options.

In order to be consistent with the “task scheduler”, it could be two separate options (e.g. “command” and “args”):

set container name busybox image alpine
set container name busybox command echo
set container name busybox args “Hello World”

Or maybe an alternative syntax is better?

set container name busybox image alpine
set container name busybox command echo Hello World!

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

johannrichard renamed this task from Add “command” and “arg” configuration options to T4014: Add “command” and “arg” configuration options.Nov 22 2021, 7:32 PM
johannrichard renamed this task from T4014: Add “command” and “arg” configuration options to Add “command” and “arg” configuration options.
johannrichard created this task.
johannrichard renamed this task from Add “command” and “arg” configuration options to Add “command” and “arg” configuration options for containers.Nov 22 2021, 7:46 PM

We try not to use "raw options" of commands.
But I don't see another universal solution for it.

This comment was removed by Zach.

@johannrichard Is there any real example that you want to achieve?

@Viacheslav, appreciate your question, and yes, there is:

ntopng/ntopng (https://hub.docker.com/r/ntop/ntopng/) as well as nprobe require that their configuration options and/or an option with the path to a config file are passed as arguments, it won’t just pick up a/any file, and thus won’t run without proper command arguments.

There are certainly others, but these are the ones I’m working towards running on VyOS.*


*Although it’s a bit off-topic: if you wonder why I want ntopng running in VyOS in a docker container:

  • VyOS’ netflow output already being aggregated means it can’t easily be picked-up and worked with in ntopng running on another machine;
  • from a license point of view, running ntopng on VyOS is ideal as this doesn’t require a commercial/paid license; and
  • besides, even if I’d run ntopng elsewhere, I would need nprobe or another net flow exporter running in VyOS. And nprobe, if run as a docker image, requires command line arguments as well)

@Viacheslav, appreciate your question, and yes, there is:

ntopng/ntopng (https://hub.docker.com/r/ntop/ntopng/) as well as nprobe require that their configuration options and/or an option with the path to a config file are passed as arguments, it won’t just pick up a/any file, and thus won’t run without proper command arguments.

There are certainly others, but these are the ones I’m working towards running on VyOS.*

I wrote an earlier comment and deleted it because I wasn't sure of its relevance. It was just a pointer to Podman's support for docker-compose. Docker describes Compose as "a tool for defining and running multi-container Docker applications."

It seems VyOS config is targeting the Podman CLI to define and run containers. There seems to be some level of manual work required to support additional arguments.

Could it be feasible/more efficient to target docker-compose instead of the Podman CLI to define and run containers?

I use docker-compose personally for both development and single node production environments. It makes it much simpler to manage multiple containers and dependencies at once.

Edited to add:
https://www.redhat.com/sysadmin/podman-docker-compose
docker-compose is a single binary written in Go (prev Python).

Certbot (specifically certbot/dns-cloudflare container) is another situation where a command & argument is required. Currently, I get around it by running a task-schedule to run the podman command directly (its a task because the container runs to completion). But having a way to do this via VyOS CLI would be extra helpful.

I've created a pull request which add support for this, and yes, it does use raw command.
I know that here we want to avoid "raw options" but I think this is one of the most needed feature and I don't see any other way else to do this. Until a better option is found, I think my PR should do just fine.

I added 3 configuration options

  • command
  • arguments
  • entrypoint

You can use " with "
You can use ' with '

Viacheslav changed the task status from Open to Needs testing.Feb 28 2023, 8:22 AM
Viacheslav assigned this task to Zen3515.

Implemented

vyos@r4# set container name c1 
Possible completions:
   allow-host-networks  Allow host networks in container
   arguments            The command's arguments for this container
+  cap-add              Container capabilities/permissions
   command              Override the default CMD from the image