Code Monkey home page Code Monkey logo

hypercli's Introduction

HyperCLI Build Status

Go version of Hyper.sh client command line tools.

Install

Quick and Easy (Recommended)

Grab the latest version for your system on the Releases page or build it by yourself as the instruction.

You can either run the binary directly or add somewhere in your $PATH.

Getting Started

Before Getting Started

Before you can use Hyper.sh, be sure you've created a free account with Hyper.sh and generate your credentials on Hyper.sh.

Once the installation and setup completes, enter hyper config in your terminal. The CLI will prompt to ask for your API credential:

The credential is stored in a local configuration file $HOME/.hyper/config.json. The configuration file is similar to Docker's, with an extra section clouds.

Or you can use environmental vairables HYPER_ACCESS and HYPER_SECRET to pass the access key and secret key (CLI will search for these envs before loading the configuration file).

You only need to do that once for your machine. If you've done that, then you can continue.

See the official docs for more detailed info on using Hyper.sh.

Actually Getting Started

The easiest way to get started is by digging around.

$ hyper --help for example usage and a list of commands

How to build

$ mkdir $GOPATH/src/github.com/hyperhq/
$ cd $GOPATH/src/github.com/hyperhq/
$ git clone https://github.com/hyperhq/hypercli hypercli
$ cd hypercli
$ ./build.sh

Contributing

Give us a pull request! File a bug!

hypercli's People

Contributors

ahmetb avatar albers avatar alexlarsson avatar aluzzardi avatar calavera avatar carmark avatar coolljt0725 avatar cpuguy83 avatar creack avatar dhrp avatar dmcgowan avatar estesp avatar hqhq avatar jamtur01 avatar jessfraz avatar jimmy-xu avatar lk4d4 avatar metalivedev avatar mzdaniel avatar rhvgoyal avatar runcom avatar shin- avatar svendowideit avatar thajeztah avatar tianon avatar tiborvass avatar unclejack avatar vbatts avatar vdemeester avatar vieux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hypercli's Issues

No error message when start a "--link parent:parent" container when parent is stopped

First I run a container called "parent",and stop it.Then I create a container "child-first" with "--link parent:parent", and I try to start it, it return the container name as if it successed.
But in fact it should return the error message "Error response from daemon: Cannot start container child-first: Cannot link to a non running container: /parent AS /child-first/parent"," Error: failed to start containers: [child-first]"。

container name regex conflict with the random name

hyper has the container name regex([a-z0-9]([-a-z0-9]*[a-z0-9])?). So, we cant use name like xl_gao. But the random name appears name like cranky_archimedes. I think its a tiny bug, but its confusing.

run -d and exec -i make terminal no reply

How to Reproduce:

xlgao@xlgao-pc:~/gocode/src/github.com/hyperhq/hypercli/hyper$ hyper -H tcp://147.75.195.39:6443 run -d busybox sh
54d49f51e70efb4e65f35b8cddc9c9149d54b04ae529f05a6323f739872ed914
xlgao@xlgao-pc:~/gocode/src/github.com/hyperhq/hypercli/hyper$ hyper -H tcp://147.75.195.39:6443 exec -i 54d49f51e70efb4e65f35b8cddc9c9149d54b04ae529f05a6323f739872ed914 /bin/sh

Wired behavior of snapshot and volume command

I have a lot of volumes and snapshots which are dependent with each other. After some operations, I deleted all the snapshots, while there are some volumes I can't remove, Error Message "Volume still has 1 dependent snapshots."

hyper info :
Containers: 7
 Running: 1
 Paused: 0
 Stopped: 6
Images: 4
Server Version: Hyper_ beta
Storage Driver: hyper
Execution Driver: hyper.sh
Plugins: 
 Volume: hyper storage
 Network: hyper network
 Authorization: Access-Key
Kernel Version: 4.0.0
CPUs: 0
Total Memory: 0 B
ID: f7929220601e4823974196051bb80fe4
Debug mode (client): false
Debug mode (server): false

But I couldn't reproduce this bug anymore, maybe It's caused by server updating recently.
If I can reproduce this in the future, I'll update this issue later.

But truely, there is some inconsistence in snapshot when I try to reproduce the bug.
How to reproduce:

hyper create volume --name test-volume-1
hyper create snapshot --name test-snap-1 -v test-volume-1
hyper run --name test-rm -v test-volume-1:/opt/data -d busybox sh
hyper rm -fv test-rm

If you run command hyper snapshot ls, there is no snapshot test-snap-1 anymore. But It do exist.
you can delete it again by run hyper snapshot rm test-snap-1 or create a volume base on test-snap-1. I think it's command rm -v which cause the inconsistence.

[bug] volume rm error

At first I create a volume "test", I attach it with a container.Then I stop and rm the container.But I cannot rm "test", because " Volume test is still attached, detach volume first.".In fact the container has already disappeared.
And if I create the snapshot based on the above volume "test", it also will meet the error " The server encountered an internal error or misconfiguration...".

[feature request] "hyper volume ls -f"

The option of "-f" is useless.As long as the argument satisfy the format "key=value", then it will print all of the volume.Of course, the format "dangling=invalid" which should be invalid is OK.
It is better to add the feature when I pass "-f dangling=true",it will only print the volume in use.And other invalid argument like "-f FOO=123" will return error.

successful `hyper rm` reports error

➜  ~ hyper ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES                    PUBLIC IP
885006fe63b7        docker              "docker-entrypoint.sh"   21 minutes ago      Exited (0) 35 seconds ago                       docker
a6bc6d75475d        docker              "docker-entrypoint.sh"   27 minutes ago      Exited (0) 21 minutes ago                       big_swartz
14a47e722d4d        docker              "docker-entrypoint.sh"   28 minutes ago      Exited (0) 27 minutes ago                       gigantic_blackwell
a9b4c4b0f86d        ubuntu              "/bin/bash"              29 minutes ago      Exited (0) 28 minutes ago                       agitated_bartik
1a4aa2c4d845        ubuntu              "/bin/bash"              29 minutes ago      Exited (0) 29 minutes ago                       reverent_chandrasekhar

➜  ~ hyper rm 1a4aa2c4d845 a9b4c4b0f86d 14a47e722d4d a6bc6d75475d 885006fe63b7
Error response from daemon: No such container: 1a4aa2c4d845
Error response from daemon: No such container: a9b4c4b0f86d
Error response from daemon: No such container: 14a47e722d4d
Error response from daemon: No such container: a6bc6d75475d
Error response from daemon: No such container: 885006fe63b7

[bug] errors about "attach api"

(1) First, run a container with command "hypercli run -di busybox cat".
Then request "POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", and read from stdout which should success, but timeout.
(2) Run a container with command "hypercli run -di busybox /bin/sh -c cat >&2"
Then request "POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1" , and read from stderr which should success,but timeout
Request "POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1",and read from stderr which should timeout, but err is nil
(3)Run a container with command "hypercli run -dit busybox /bin/sh -c cat >&2"
Then request "POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", and read from stdout which should success but timeout

issue about logs

we should pass this test case, but for now ,we can not pass it.

dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")

status, body, err := sockRequest("GET", fmt.Sprintf("/containers/%s/logs", name), nil)
c.Assert(status, checker.Equals, http.StatusBadRequest)
c.Assert(err, checker.IsNil)

expected := "Bad parameters: you must choose at least one stream"

I get

... obtained int = 500
... expected int = 400

wrong statuscode returned by exec api

there two issues about exec api

    1. call exec start after stopping container, code like this
id = createExec(c, "test")
dockerCmd(c, "stop", "test")
startExec(c, id, http.StatusNotFound)
... obtained int = 200
... expected int = 409
    1. call exec start multiple times, code like this
runSleepingContainer(c, "-d", "--name", "test")
execID := createExec(c, "test")
startExec(c, execID, http.StatusOK)
startExec(c, execID, http.StatusConflict)
... obtained int = 200
... expected int = 409

[bug] Command `kill` does not work properly

  1. When kill a running container, get error message "Error response from daemon: Cannot kill container X: Container X is not running".
    How to Reproduce:
    hyper run -d busybox top
    hyper kill $contianer_id
  2. When kill a stoped container, we should get an error message, something like we got from [1]. While we only got a container id.

[bug] remove a nonexistent container causes panic

When I remove a nonexistent container, I get a panic. The error message is shown below.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x53ffb1]

goroutine 1 [running]:
panic(0xa332a0, 0xc82000e190)
    /opt/go/src/runtime/panic.go:464 +0x3e6
encoding/json.(*Decoder).refill(0xc8203dc000, 0x0, 0x0)
    /opt/go/src/encoding/json/stream.go:152 +0x281
encoding/json.(*Decoder).readValue(0xc8203dc000, 0x1, 0x0, 0x0)
    /opt/go/src/encoding/json/stream.go:128 +0x413
encoding/json.(*Decoder).Decode(0xc8203dc000, 0x902120, 0xc82025b100, 0x0, 0x0)
    /opt/go/src/encoding/json/stream.go:57 +0x159
github.com/docker/engine-api/client.(*Client).ContainerRemove(0xc8200a6240, 0x7ffde265d190, 0x4, 0xc820000000, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/xlgao/gocode/src/github.com/hyperhq/hypercli/vendor/src/github.com/docker/engine-api/client/container_remove.go:26 +0x50e
github.com/hyperhq/hypercli/api/client.(*DockerCli).removeContainer(0xc8200a61b0, 0x7ffde265d190, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/xlgao/gocode/src/github.com/hyperhq/hypercli/api/client/rm.go:55 +0xcb
github.com/hyperhq/hypercli/api/client.(*DockerCli).CmdRm(0xc8200a61b0, 0xc8200780b0, 0x1, 0x1, 0x0, 0x0)
    /home/xlgao/gocode/src/github.com/hyperhq/hypercli/api/client/rm.go:31 +0x5c4
reflect.callMethod(0xc8202c48d0, 0xc820199c28)
    /opt/go/src/reflect/value.go:631 +0x1fc
reflect.methodValueCall(0xc8200780b0, 0x1, 0x1, 0x1, 0xc8202c48d0, 0x0, 0x0, 0xc8202c48d0, 0x0, 0x468724, ...)
    /opt/go/src/reflect/asm_amd64.s:29 +0x36
github.com/hyperhq/hypercli/cli.(*Cli).Run(0xc8202c4540, 0xc8200780a0, 0x2, 0x2, 0x0, 0x0)
    /home/xlgao/gocode/src/github.com/hyperhq/hypercli/cli/cli.go:89 +0x384
main.main()
    /home/xlgao/gocode/src/github.com/hyperhq/hypercli/hyper/hyper.go:63 +0x435

[bug] Limit of link alias's length

hyper run -d busybox top
hyper create --link $container_id busybox top

Got error "Error response from daemon: Link alias ($container_id provided) should fit RFC11123 format a-z0-9?"

Hyper stats a non-existent container error

When I hyper stats a non-existent container, the return message is not stable.Sometimes it may return the message that the container is not exist.But sometimes it may return the normal stats as if it is an existent container.
Especially when I hyper stats a non-existent container with "--no-stream=false", at first it may return the stats, but after a while the stats disappear as if it realize the mistake!

ps format multi names get wrong behavior

How to Reproduce:

hyper run -d --name child busybox top
hyper run -d --name parent --link=child:linkedone busybox top
hyper ps --format {{.Names}} --no-trunc

should get

parent
child,parent/linkedone

actually get

parent
child

[bug]hyper attach return empty string

At first , I run a container "hypercli run -itd busybox cat", and then attach it , input "hello\n", in test case TestAttachDetachTruncatedID(docker_cli_attach_unix_test.go),it read an empty string and err = EOF.But if I do all of it by hand ,everything seems OK , its so confusing.And delay is useless

rm a blank image, return 404 page not found

[root@81b7659c2a09 integration-cli]# hyper -H ${DOCKER_HOST} rmi ""
Error response from daemon: 404: Page Not Found
Obvisouly,this corner is not considered.In docker, the daemon will return "image name cannot be blank"

[bug] `run -e=KEY` in hyper is not consist with docker

docker run -e FOO busybox env
Get result:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=2da5648c6781
HOME=/root

hyper run -e FOO busybox env
Get result:

hyper: Error response from daemon: Misconfigured environment FOO, Env name should match [A-Za-z_][A-Za-z0-9_]*.

enviroment FOO is not configured on local host.

Expect:
behavior should be consist with docker Or use a more inspiring error message.

https://github.com/hyperhq/hypercli/blob/integration-test/integration-cli/todo/cli/docker_cli_run_test.go#L772-L879

[bug] create container with nonexistent image

I create a container by nonexistent image such as "test234".As usual it should return the error message "No such image: test456:latest",but in hyper, it will response "No such image: test456",without tag "latest".

Is Hyper_ `logs` command work differently from docker?

Now, hyper logs could only get a running container's logs, which is different from docker. Is that normal or just a bug not been fixed yet?
Similar to this,

  • If we get logs from a stopped container, there will be an error.
  • If we restart a container, logs from the previous running will no longer be exist.

`hyper pull scratch` return "internal error"

"scratch" is a reserved name.

$ hyper pull scratch
Using default tag: latest
Error response from daemon: The server encountered an internal error or misconfiguration...
$ docker pull scratch
Using default tag: latest
Error response from daemon: 'scratch' is a reserved name

[api bug] error message of create is not correct

"POST", "/containers/create", config

If config is empty, should get error message "Config cannot be empty in order to create a container\n"
not "The server encountered an internal error or misconfiguration...\n"

ps -f gets wrong behavior

How to Reproduce:

hypercli run -d --name t1 busybox top
hypercli run -d --name t2 busybox top
hypercli run -d --name t3 busybox true
hypercli run -d --name t4 busybox top

hypercli ps -f "before=t3" will get error like this Error response from daemon: The server encountered an internal error or misconfiguration....

hypercli ps -f "before=t3'ID" will not get any container.

issue about fip release api

All the fip apis are cool, except fip release. I can't pass the test case about fip release.

The test code is test code about fip release.

we should get 204, but we get 200. And after I called fip release api, I run hyper fip ls, I find that ip isn't released.

[API doc bug] the snapshot API

(1)In the API doc, all the APIs of snapshot miss 's'.
For example, snapshot creating is "/snapshot/create", but in fact it should be "/snapshots/create".
(2)In the doc of snapshot create:" POST /snapshot/createi?name=snapshot-tardis&volume=tardis",there is no "i" after "create".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.