[SOLVED] How to use cli to download image from opennebula marketplace

I have a problem to run sunstone in this issue, so I am trying to use cli to download images from the opennbula marketplace using onemarketapp downlod command. And instantiate this image template

I followd this guide but it does not mention how to import or download images from opennebula Marketplace

Steps to reproduce
$one start
$sunston-server start
$onemarketapp list to get the image id
$onedatastore show default to get the path of the image datastore
$onemarketapp download 10 <path/to/default/datastore>

I got this error

Traceback (most recent call last):
9: from /home/oneadmin/installation/bin/onemarketapp:43:in <main>' 8: from /home/oneadmin/installation/bin/onemarketapp:43:in new’
7: from /home/oneadmin/installation/lib/ruby/cli/command_parser.rb:84:in initialize' 6: from /home/oneadmin/installation/lib/ruby/cli/command_parser.rb:470:in run’
5: from /home/oneadmin/installation/bin/onemarketapp:201:in block (2 levels) in <main>' 4: from /home/oneadmin/installation/lib/ruby/cli/one_helper.rb:846:in perform_action’
3: from /home/oneadmin/installation/bin/onemarketapp:203:in block (3 levels) in <main>' 2: from /home/oneadmin/installation/lib/ruby/cli/one_helper.rb:1635:in download_resource_sunstone’
1: from /home/oneadmin/installation/lib/ruby/cli/one_helper.rb:1635:in open' /home/oneadmin/installation/lib/ruby/cli/one_helper.rb:1635:in initialize’: Is a directory @ rb_sysopen - /home/oneadmin/installation/var//datastores/1 (Errno::EISDIR)

Thanks in advance

You need the export command.

onemarketapp export <app_id> <local_app_name> -d 1

Sorry to be late. Thank you for the reply
when I followed the guide you gave I was stuck in making a new app
$ cat templates/marketapp.tpl
NAME=TTYlinux
ORIGIN_ID=0
TYPE=image

and when I run
$ onemarketapp create ~/templates/marketapp.tpl -m "OpenNebula Public"

It returns
[one.marketapp.allocate] Create disabled for market: OpenNebula Public
what shoud I do ?

Hello @abdullah

You can’t create an app in the official OpenNebula repository, you can only create apps on your own marketplaces.

Thanks , and sorry for the confusion. this link helps me alot

first

$ onemarketapp list

You can filter the output with standard stream processing tools, e.g. grep :

$ onemarketapp list | grep -i ubuntu
68 ubuntu_xenial - LXD           1.0 1024M  rdy  img 05/27/19 Linux Containers   0
67 ubuntu_trusty - LXD           1.0 1024M  rdy  img 05/27/19 Linux Containers   0
66 ubuntu_eoan - LXD             1.0 1024M  rdy  img 05/27/19 Linux Containers   0
65 ubuntu_disco - LXD            1.0 1024M  rdy  img 05/27/19 Linux Containers   0
64 ubuntu_cosmic - LXD           1.0 1024M  rdy  img 05/27/19 Linux Containers   0
63 ubuntu_bionic - LXD           1.0 1024M  rdy  img 05/27/19 Linux Containers   0
62 ubuntu-core_16 - LXD          1.0 1024M  rdy  img 05/21/19 Linux Containers   0
31 Ubuntu 16.04 with Docker  5.8.0-1  2.2G  rdy  img 02/26/19 OpenNebula Public  0
29 Ubuntu 16.04 with Docker  5.8.0-1  2.2G  rdy  img 02/26/19 OpenNebula Public  0
23 Ubuntu 14.04 - KVM        5.8.0-1  2.2G  rdy  img 02/26/19 OpenNebula Public  0
20 Ubuntu for Docker Machine 0.6.0-2   10G  rdy  img 02/22/16 OpenNebula Public  0
16 Ubuntu 18.10 - KVM        5.8.0-1  2.2G  rdy  img 02/26/19 OpenNebula Public  0
15 Ubuntu 18.04 - KVM        5.8.0-1  2.2G  rdy  img 02/26/19 OpenNebula Public  0
11 Ubuntu 16.04 - KVM        5.8.0-1  2.2G  rdy  img 02/26/19 OpenNebula Public  0
 8 Ubuntu 19.04 - KVM        5.8.0-1  2.2G  rdy  img 05/06/19 OpenNebula Public  0
 1 Ubuntu 18.04 - EC2        5.8.0-1    0M  rdy  tpl 02/26/19 OpenNebula Public  0
 0 Ubuntu 16.04 - EC2        5.8.0-1    0M  rdy  tpl 02/26/19 OpenNebula Public  0

Then export the image to the default image datastore
onemarketapp export 10 'Ttylinux - KVM' -d 1

Yes, that’s the correct way. You can also use the command onemarketapp download to download the image to a local path in your server.

Thanks @ahuertas
Is the path has to be a path to a file or a path to a directory ?

To a file, you can check it by using onemarketapp download --help.

Which type of a file ? is $ touch new_file is enough ? @ahuertas

Hello @abdullah

You don’t need to create any file, the command will create it.

Thank you a lot @ahuertas