Permalink
Browse files

version command

  • Loading branch information...
kcq committed Aug 13, 2017
1 parent 8142acd commit df6d52c2ebd1da24cf4293795a01f583ec271724
Showing with 14,501 additions and 23 deletions.
  1. +3 −1 README.md
  2. +10 −0 cmd/docker-slim/cli.go
  3. +44 −0 master/commands/version.go
  4. +140 −5 vendor/github.com/cloudimmunity/go-dockerclientx/misc.go
  5. +2 −2 vendor/github.com/cloudimmunity/system/architecture.go
  6. +146 −0 vendor/github.com/cloudimmunity/system/os_release_linux.go
  7. +11 −0 vendor/github.com/cloudimmunity/system/system.go
  8. +82 −0 vendor/github.com/cloudimmunity/system/system_darwin.go
  9. +60 −9 vendor/github.com/cloudimmunity/system/system_linux.go
  10. +191 −0 vendor/github.com/docker/docker/LICENSE
  11. +19 −0 vendor/github.com/docker/docker/NOTICE
  12. +23 −0 vendor/github.com/docker/docker/api/types/blkiodev/blkio.go
  13. +69 −0 vendor/github.com/docker/docker/api/types/container/config.go
  14. +21 −0 vendor/github.com/docker/docker/api/types/container/container_changes.go
  15. +21 −0 vendor/github.com/docker/docker/api/types/container/container_create.go
  16. +21 −0 vendor/github.com/docker/docker/api/types/container/container_top.go
  17. +17 −0 vendor/github.com/docker/docker/api/types/container/container_update.go
  18. +17 −0 vendor/github.com/docker/docker/api/types/container/container_wait.go
  19. +380 −0 vendor/github.com/docker/docker/api/types/container/host_config.go
  20. +41 −0 vendor/github.com/docker/docker/api/types/container/hostconfig_unix.go
  21. +54 −0 vendor/github.com/docker/docker/api/types/container/hostconfig_windows.go
  22. +22 −0 vendor/github.com/docker/docker/api/types/container/waitcondition.go
  23. +130 −0 vendor/github.com/docker/docker/api/types/mount/mount.go
  24. +108 −0 vendor/github.com/docker/docker/api/types/network/network.go
  25. +30 −0 vendor/github.com/docker/docker/api/types/strslice/strslice.go
  26. +40 −0 vendor/github.com/docker/docker/api/types/swarm/common.go
  27. +31 −0 vendor/github.com/docker/docker/api/types/swarm/config.go
  28. +72 −0 vendor/github.com/docker/docker/api/types/swarm/container.go
  29. +119 −0 vendor/github.com/docker/docker/api/types/swarm/network.go
  30. +115 −0 vendor/github.com/docker/docker/api/types/swarm/node.go
  31. +19 −0 vendor/github.com/docker/docker/api/types/swarm/runtime.go
  32. +3 −0 vendor/github.com/docker/docker/api/types/swarm/runtime/gen.go
  33. +712 −0 vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go
  34. +18 −0 vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto
  35. +32 −0 vendor/github.com/docker/docker/api/types/swarm/secret.go
  36. +124 −0 vendor/github.com/docker/docker/api/types/swarm/service.go
  37. +217 −0 vendor/github.com/docker/docker/api/types/swarm/swarm.go
  38. +184 −0 vendor/github.com/docker/docker/api/types/swarm/task.go
  39. +67 −0 vendor/github.com/docker/go-units/CONTRIBUTING.md
  40. +191 −0 vendor/github.com/docker/go-units/LICENSE
  41. +27 −0 vendor/github.com/docker/go-units/MAINTAINERS
  42. +16 −0 vendor/github.com/docker/go-units/README.md
  43. +11 −0 vendor/github.com/docker/go-units/circle.yml
  44. +35 −0 vendor/github.com/docker/go-units/duration.go
  45. +108 −0 vendor/github.com/docker/go-units/size.go
  46. +118 −0 vendor/github.com/docker/go-units/ulimit.go
  47. +36 −0 vendor/github.com/gogo/protobuf/LICENSE
  48. +43 −0 vendor/github.com/gogo/protobuf/proto/Makefile
  49. +234 −0 vendor/github.com/gogo/protobuf/proto/clone.go
  50. +978 −0 vendor/github.com/gogo/protobuf/proto/decode.go
  51. +172 −0 vendor/github.com/gogo/protobuf/proto/decode_gogo.go
  52. +100 −0 vendor/github.com/gogo/protobuf/proto/duration.go
  53. +203 −0 vendor/github.com/gogo/protobuf/proto/duration_gogo.go
  54. +1,362 −0 vendor/github.com/gogo/protobuf/proto/encode.go
  55. +350 −0 vendor/github.com/gogo/protobuf/proto/encode_gogo.go
  56. +300 −0 vendor/github.com/gogo/protobuf/proto/equal.go
  57. +693 −0 vendor/github.com/gogo/protobuf/proto/extensions.go
  58. +294 −0 vendor/github.com/gogo/protobuf/proto/extensions_gogo.go
  59. +897 −0 vendor/github.com/gogo/protobuf/proto/lib.go
  60. +42 −0 vendor/github.com/gogo/protobuf/proto/lib_gogo.go
  61. +311 −0 vendor/github.com/gogo/protobuf/proto/message_set.go
  62. +484 −0 vendor/github.com/gogo/protobuf/proto/pointer_reflect.go
  63. +85 −0 vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go
  64. +270 −0 vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go
  65. +128 −0 vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
  66. +968 −0 vendor/github.com/gogo/protobuf/proto/properties.go
  67. +111 −0 vendor/github.com/gogo/protobuf/proto/properties_gogo.go
  68. +119 −0 vendor/github.com/gogo/protobuf/proto/skip_gogo.go
  69. +928 −0 vendor/github.com/gogo/protobuf/proto/text.go
  70. +57 −0 vendor/github.com/gogo/protobuf/proto/text_gogo.go
  71. +1,013 −0 vendor/github.com/gogo/protobuf/proto/text_parser.go
  72. +113 −0 vendor/github.com/gogo/protobuf/proto/timestamp.go
  73. +229 −0 vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go
  74. +60 −6 vendor/vendor.json
View
@@ -61,6 +61,7 @@ Latest version: 1.18 (8/9/2017)
* Alpine image support (NEW)
* New sample apps (NEW)
* Extended version information (NEW)
* Ability to override ENV variables analyzing target image
* Docker 1.12 support
* User selected location to store DockerSlim state (global `--state-path` parameter).
@@ -82,7 +83,7 @@ If the directory where you extracted the binaries is not in your PATH then you'l
## BASIC USAGE INFO
`docker-slim [info|build|profile] [--http-probe|--remove-file-artifacts] <IMAGE_ID_OR_NAME>`
`docker-slim [version|info|build|profile] [--http-probe|--remove-file-artifacts] <IMAGE_ID_OR_NAME>`
Example: `docker-slim build --http-probe my/sample-node-app`
@@ -180,6 +181,7 @@ Commands:
* `build` - Collect fat image information and build a slim image from it
* `profile` - Collect fat image information and generate a fat container report
* `info` - Collect fat image information and reverse engineers its Dockerfile (no runtime container analysis)
* `version` - Show docker-slim and docker version information
Global options:
View
@@ -188,6 +188,16 @@ func init() {
}
app.Commands = []cli.Command{
{
Name: "version",
Aliases: []string{"v"},
Usage: "Shows docker-slim and docker version information",
Action: func(ctx *cli.Context) error {
clientConfig := getDockerClientConfig(ctx)
commands.OnVersion(clientConfig)
return nil
},
},
{
Name: "info",
Aliases: []string{"i"},
View
@@ -0,0 +1,44 @@
package commands
import (
"fmt"
"github.com/docker-slim/docker-slim/master/config"
"github.com/docker-slim/docker-slim/master/docker/dockerclient"
"github.com/docker-slim/docker-slim/pkg/version"
)
// OnVersion implements the 'version' docker-slim command
func OnVersion(clientConfig *config.DockerClient) {
fmt.Println("docker-slim:")
fmt.Println(version.Current())
fmt.Println("docker:")
client := dockerclient.New(clientConfig)
info, err := client.Info()
if err != nil {
fmt.Println("error getting docker info")
return
}
fmt.Printf("Name=%v\n", info.Name)
fmt.Printf("KernelVersion=%v\n", info.KernelVersion)
fmt.Printf("OperatingSystem=%v\n", info.OperatingSystem)
fmt.Printf("OSType=%v\n", info.OSType)
fmt.Printf("ServerVersion=%v\n", info.ServerVersion)
fmt.Printf("Architecture=%v\n", info.Architecture)
version, err := client.Version()
if err != nil {
fmt.Println("error getting docker version")
return
}
fmt.Printf("ApiVersion=%v\n", version.Get("ApiVersion"))
fmt.Printf("MinAPIVersion=%v\n", version.Get("MinAPIVersion"))
fmt.Printf("BuildTime=%v\n", version.Get("BuildTime"))
fmt.Printf("GitCommit=%v\n", version.Get("GitCommit"))
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit df6d52c

Please sign in to comment.