canonical / lxd-demo-server

The LXD demo server

Home Page:https://linuxcontainers.org/lxd/try-it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Container Not Found

DilipRenkila opened this issue · comments

*****My config file

quota_cpu: 1
quota_ram: 128
quota_disk: 5
quota_sessions: 2
quota_time: 3000
quota_processes: 200
container: "u1"
image: "ubuntu_wily"
server_addr: "[::]:8080"
server_banned_ips:
- 1.2.3.4
server_console_only: true
server_containers_max: 50
server_cpu_count: 2
server_ipv6_only: true
server_maintenance: false
server_terms: |-
  By using the LXD demonstration server, you agree that:<br />
  <ul>
    <li>Access to this service may be revoked at any time for any reason</li>
    <li>Access to this service is solely provided to evaluate LXD</li>
    <li>Your IP address, access time and activity on the test server may be recorded</li>
    <li>Any abuse of this service may lead to a ban or other applicable actions</li>
  </ul>

******* $ lxc list

+------+---------+--------------------------------+------+------------+-----------+
| NAME |  STATE  |              IPV4              | IPV6 |    TYPE    | SNAPSHOTS |
+------+---------+--------------------------------+------+------------+-----------+
| u1   | RUNNING | 10.0.3.67 (eth0)               |      | PERSISTENT | 0         |
|      |         | 10.0.3.1 (lxcbr0)              |      |            |           |
+------+---------+--------------------------------+------+------------+-----------+

****** i contain container named ''u1'' but while curling i get the following error
*****curl http://localhost:8080/1.0/info )
***
** Container not found
I want to know the mistake i did and how to write the config file?

/1.0/info is an endpoint that you can only use after you started a container. It returns the exact same information as you get back on a successful container startup.

It's used to allow the user to re-attach to an existing container by just keeping the container uuid around.

Example:

stgraber@castiana:~/data/code/lxc/lxd-demo-server (master)$ curl http://lxd-demo01.srv.mtl:8080/1.0 -s | jq .
{
  "client_address": "2607:f2c0:f00f:2700:6257:18ff:fef0:c201",
  "client_protocol": "IPv6",
  "containers_count": 0,
  "containers_max": 100,
  "containers_next": 0,
  "server_console_only": false,
  "server_ipv6_only": true,
  "server_status": 0
}

stgraber@castiana:~/data/code/lxc/lxd-demo-server (master)$ curl http://lxd-demo01.srv.mtl:8080/1.0/terms -s | jq .
{
  "hash": "cdc4b35091fec84631f4d3d4fb626f34c4acb815fa2df7af17a51cecc888d5a1",
  "terms": "By using the LXD demonstration server, you agree that:<br />\n<ul>\n  <li>Access to this service may be revoked at any time for any reason</li>\n  <li>Access to this service is solely provided to evaluate LXD</li>\n  <li>Your IP address, access time and activity on the test server may be recorded</li>\n  <li>Any abuse of this service may lead to a ban or other applicable actions</li>\n</ul>\n\nThe demo environment comes with the following restrictions:<br />\n<ul>\n  <li>30 minutes limit per session</li>\n  <li>Limit of 5 sessions per IP</li>\n  <li>1 shared CPU core</li>\n  <li>256MB of dedicated memory</li>\n  <li>5GB of dedicated disk space</li>\n  <li>IPv6 only network connectivty with limited connectivity (whitelist)</li>\n</ul>"
}

stgraber@castiana:~/data/code/lxc/lxd-demo-server (master)$ curl http://lxd-demo01.srv.mtl:8080/1.0/start?terms=cdc4b35091fec84631f4d3d4fb626f34c4acb815fa2df7af17a51cecc888d5a1 -s | jq .
{
  "expiry": 1458315906,
  "fqdn": "tryit-coalier.lxd",
  "id": "7bac8884-c432-48c2-a030-401b6405f899",
  "ip": "2607:f2c0:f00f:2770:216:3eff:fecb:d1da",
  "password": "waterlocked",
  "status": 0,
  "username": "uncognized"
}

stgraber@castiana:~/data/code/lxc/lxd-demo-server (master)$ curl http://lxd-demo01.srv.mtl:8080/1.0/info?id=7bac8884-c432-48c2-a030-401b6405f899 -s | jq .
{
  "expiry": 1458315906,
  "fqdn": "tryit-coalier.lxd",
  "id": "7bac8884-c432-48c2-a030-401b6405f899",
  "ip": "2607:f2c0:f00f:2770:216:3eff:fecb:d1da",
  "password": "waterlocked",
  "status": 0,
  "username": "uncognized"
}

In this example I query the server status, then the terms, I get the current version of the terms which I then pass to /start (confirming I've read them), a container is created for me that I could connect to and I then use /info to get that same information again just from the container id.