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

**URL:** <https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894>\
**Category:** Installation & Configuration\
**Tags:** solved\
**Created:** [December 5, 2019, 11:13am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894 "2019-12-05T11:13:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.opennebula.io/u/abdullah)\
**Post date:** [December 5, 2019, 11:13am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/1 "2019-12-05T11:13:22Z")

</div>

I have a problem to run sunstone in this [issue](https://forum.opennebula.io/t/sunstone-is-loading-to-infinity/7893), 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](https://docs.opennebula.org/5.10/advanced_components/marketplace/marketapp.html) 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

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [December 5, 2019, 3:07pm UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/2 "2019-12-05T15:07:22Z")

</div>

You need the [export](https://docs.opennebula.org/5.10/advanced_components/marketplace/marketapp.html#exporting-a-marketplaceapp) command.

`onemarketapp export <app_id> <local_app_name> -d 1`

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.opennebula.io/u/abdullah)\
**Post date:** [December 8, 2019, 8:34am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/3 "2019-12-08T08:34:49Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)\
**Post date:** [December 9, 2019, 9:38am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/4 "2019-12-09T09:38:15Z")

</div>

Hello @abdullah

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

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.opennebula.io/u/abdullah)\
**Post date:** [December 9, 2019, 12:15pm UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/5 "2019-12-09T12:15:14Z")

</div>

Thanks , and sorry for the confusion. this [link](https://github.com/OpenNebula/minione/wiki/Marketplace-over-CLI) helps me alot

first

```auto
$ onemarketapp list

```

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

```auto
$ 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`

---

<div class="post-metadata">

**Author:** ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)\
**Post date:** [December 10, 2019, 8:19am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/6 "2019-12-10T08:19:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.opennebula.io/u/abdullah)\
**Post date:** [December 10, 2019, 1:28pm UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/7 "2019-12-10T13:28:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)\
**Post date:** [December 10, 2019, 3:21pm UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/8 "2019-12-10T15:21:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.opennebula.io/u/abdullah)\
**Post date:** [December 15, 2019, 8:50am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/9 "2019-12-15T08:50:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahuertas](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ahuertas/32/7487_2.png) [@ahuertas](https://forum.opennebula.io/u/ahuertas)\
**Post date:** [December 16, 2019, 8:15am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/10 "2019-12-16T08:15:46Z")

</div>

Hello @abdullah

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

---

<div class="post-metadata">

**Author:** ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.opennebula.io/u/abdullah)\
**Post date:** [December 16, 2019, 8:34am UTC](https://forum.opennebula.io/t/solved-how-to-use-cli-to-download-image-from-opennebula-marketplace/7894/11 "2019-12-16T08:34:33Z")

</div>

Thank you a lot @ahuertas
