Djordje Lukic
98976e4cb4
Cleanup entrypoint
...
* use the `fatal` function when we can
* rename moby.ExecRegardlessContext to Exec
2020-06-26 10:23:37 +02:00
Djordje Lukic
908212a947
Add version in the main package
...
This way, when we release goreleaser will inject the right version in
the ldflags
2020-06-25 12:00:37 +02:00
Djordje Lukic
0c1f0f81df
Usage metrics
...
Send usage to Docker Desktop
2020-06-23 16:52:52 +02:00
Guillaume Tardif
fa8b911cd8
Allow running `docker -v` or `--version` even if context is not default
2020-06-23 15:13:43 +02:00
Guillaume Tardif
38d4f8d25a
Shell out to Moby cli if user uses -H, regardless of context set. Moby cli will refuse both options (context & host) to be set at the same time
2020-06-23 12:00:46 +02:00
Guillaume Tardif
dbaab41604
Changed root level debug shorthand to capital D, make it consistent with Moby flag and not clash with —detach future option
2020-06-22 13:19:37 +02:00
Guillaume Tardif
45750fe104
Do not display “docker for the 2020s” as the first help line !
2020-06-19 12:21:31 +02:00
Djordje Lukic
ad72c866cc
Add license headers
2020-06-18 16:48:03 +02:00
Guillaume Tardif
ab3cd0fec1
Renamed ExecIfDefaultCtxType for more explicit behaviour
2020-06-18 09:29:01 +02:00
Guillaume Tardif
bbcdad39d5
Renamed docker-classic to “com.docker.com”.
2020-06-17 17:57:53 +02:00
Ulysses Souza
96bc1ca6f1
Add inspect command
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-06-15 15:08:04 +02:00
Guillaume Tardif
0de2522079
Renamed Moby backend to “local” backend. This will leave “moby” available for default type contexts
2020-06-15 12:20:03 +02:00
Guillaume Tardif
336df897c1
Merge pull request #207 from docker/version_cli
...
version command adding azure integration beta version in textual output
2020-06-15 12:02:33 +02:00
Guillaume Tardif
98f7a8e1aa
When can not load config file, the previous cli is displaying a WARNING message, but continues with default context, we should do the same.
...
This happened in some desktop e2e tests where the config file is not set properly in WSL2 environment, see
https://github.com/docker/pinata/pull/14062
2020-06-15 11:41:26 +02:00
Guillaume Tardif
dda4b0f3bf
Wrap error cause so that we can understand why the cli cannot determine current context.
...
This happened in Desktop WSL2 tests, we’re blind here : https://ci-next.docker.com/teams-desktop/blue/organizations/jenkins/desktop%2Fdesktop-test-single-pr-win/detail/desktop-test-single-pr-win/120692/pipeline
2020-06-14 19:38:29 +02:00
Guillaume Tardif
376a4b671c
version command adding azure integration beta version in textual output
2020-06-13 10:47:05 +02:00
Guillaume Tardif
72bae873c5
Do not delegate to old cli if cobra fails before invoking the PreRun or SetHelp hook that call isOwnCommand(). Find the command from root.Find(args).
...
Tried to use `cmd, err := root.ExecuteC()` but I can’t pass the context like with `root.ExecuteContext(ctx)`, could not find a way without and explicit call to root.Find(args)
2020-06-10 17:25:52 +02:00
Djordje Lukic
22d4d250a9
Move the config into own package and outside of cli
2020-06-08 16:01:36 +02:00
Guillaume Tardif
f939dd4d47
Display friendly message if unknown command is available in default context
2020-06-05 18:24:08 +02:00
Guillaume Tardif
e2b9f5bc57
Move login to root command, delegate to classic login when only one arg and not dot in it
2020-06-01 22:55:46 +02:00
Guillaume Tardif
528d47ce08
Add docker context inspect command relying on classic docker
2020-05-29 12:02:14 +02:00
Guillaume Tardif
ea98a2dd78
Fix docker-classic creation makefile target
2020-05-27 21:14:07 +02:00
Guillaume Tardif
cc46f84043
Forward closing signal to docker-classic when closing docker. Note this will not forward Kill signal, impossible to intercept / process this one.
2020-05-27 18:38:51 +02:00
Guillaume Tardif
66a83410dd
Ensure we have a clear error message in case of wrong setup (previously it would just exit with no error message)
2020-05-26 23:46:02 +02:00
Djordje Lukic
11339761ca
Change the way a context is stored
...
Initially we stored the context data in the `Metadata` of the context
but in hindsight this data would be better of in the `Endpoints` because
that's what it is used for.
Before:
```json
{
"Name": "aci",
"Metadata": {
"Type": "aci",
"Data": {
"key": "value"
}
},
"Endpoints": {
"docker": {}
}
}
```
After:
```json
{
"Name": "aci",
"Type": "aci",
"Metadata": {},
"Endpoints": {
"aci": {
"key": "value"
},
"docker": {}
}
}
```
With this change the contexts that we create are more in line with the contexts the docker cli creates.
It also makes the code less complicated since we don't need to marsal twice any more. The API is nicer too:
```go
// Get a context:
c, err := store.Get(contextName)
// Get the stored endpoint:
var aciContext store.AciContext
if err := contextStore.GetEndpoint(currentContext, &aciContext); err != nil {
return nil, err
}
```
2020-05-22 16:32:43 +02:00
Christopher Crone
88ba591fc3
Seed random with nanosecond time
...
It's possible that users will run commands more than once a second.
Thus, seeding the random number generator with the current time in
seconds could produce results like the same container name in subsequent
commands.
Seeding with the current time in nanoseconds reduces the probability of
this.
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-22 10:46:54 +02:00
Christopher Crone
058e6203a7
Store config dir in CLI context
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-20 15:55:05 +02:00
Guillaume Tardif
2610b986fd
delegate Moby to docker-classic binary, link docker-classic in e2e tests
2020-05-20 14:23:29 +02:00
Christopher Crone
f6fcd27a09
Factor determination of current context
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-18 14:40:15 +02:00
Djordje Lukic
42c72c365c
Split context comands into own files
2020-05-15 09:14:51 +02:00
Christopher Crone
11b4bd19f5
Refactor global CLI options
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-14 18:29:09 +02:00
Christopher Crone
9bf2924c24
Remove logrus.Fatal
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-14 17:10:24 +02:00
Christopher Crone
d46398dbef
Refactor config into package
...
* Move CLI config management into cli/config
* Add ability to save current context
* Remove ability to rename the config file as this was never used
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-14 17:10:20 +02:00
Guillaume Tardif
67a7c96dc4
Merge pull request #84 from rumpl/chore-remove-util
...
Remove util package, it was only used by cli/main.go
2020-05-13 14:23:36 +02:00
Ulysses Souza
40fa78ac5d
Add rm command
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-13 10:44:04 +02:00
Djordje Lukic
33b9525c9e
Remove util package, it was only used by cli/main.go
...
`util` is not a great name, it has no context and can quickly become a
place where we put everything and anything.
2020-05-13 10:24:16 +02:00
Christopher Crone
c93d2e9180
Context should always be handled by new CLI
...
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2020-05-12 18:05:02 +02:00
Djordje Lukic
fe1772b84a
Moby backend
2020-05-11 15:49:03 +02:00
Djordje Lukic
688e7e5deb
Implement quiet flag for ps command
2020-05-06 12:18:53 +02:00
Ulysses Souza
a4e54e9b5d
Merge pull request #41 from ulyssessouza/add-up
...
Add compose up and down
2020-05-05 16:00:44 +02:00
Ulysses Souza
161f8154de
Organize imports
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-05 15:56:00 +02:00
Guillaume Tardif
35c5073cc0
First e2e tests running locally (with example backend)
2020-05-05 14:40:30 +02:00
Ulysses Souza
03e418cbbb
Add compose up and down
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-05 14:03:14 +02:00
Djordje Lukic
24c035e822
Add comments on exported items, remove example command
...
Also add `make lint` to run the linter
2020-05-05 10:27:44 +02:00
Djordje Lukic
1c7270b697
Implement logs
2020-05-04 15:52:31 +02:00
Djordje Lukic
afca3e31b5
Implement exec command
2020-05-04 12:43:32 +02:00
Djordje Lukic
eee9bf449f
Move run to own package
2020-05-04 11:35:11 +02:00
Djordje Lukic
3d363643ad
Implement simple ACI run
2020-05-04 11:35:11 +02:00
Ulysses Souza
33c45a0a62
Add "goimports"
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-05-04 11:30:21 +02:00
Djordje Lukic
8571cf5a04
Create a new client on each request
...
`docker serve` doesn't need a context any more, the server takes the
current context from the request metadata and creates a new client
2020-04-30 12:07:26 +02:00