Commit graph

45 commits

Author SHA1 Message Date
Vincent Demeester
60e48bd6bd
Use spf13/cobra for docker rmi
Moves image command rmi to `api/client/image/remove.go` and use cobra :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-05 22:40:35 +02:00
allencloud
c1be45fa38 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-02 17:17:22 +08:00
John Howard
b0e24c7393 Windows: Remove TP4 support from test code
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-04-11 15:36:31 -07:00
Zhang Wei
62a856e912 Assert error in body of function inspectField*
1. Replace raw `docker inspect -f xxx` with `inspectField`, to make code
cleaner and more consistent
2. assert the error in function `inspectField*` so we don't need to
assert the return value of it every time, this will make inspect easier.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-01-29 23:39:07 +08:00
Arnaud Porterie
777ee34b07 Factorize sleeping containers
Add `runSleepingContainer` and `runSleepingContainerInImage` helper
functions to factor out the way to run system-specific idle containers.

Define a sleeping container as command `top` in image `busybox` for
Unix and as command `sleep 60` in image `busybox` for Windows. Provide a
single point of code to update those.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2016-01-27 08:48:08 -08:00
John Howard
916b9db71d Windows CI: Darn it, I broke due to multiple declarations
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-01-26 19:58:53 -08:00
John Howard
94e5fab5ed Windows CI: Port TestRmi tests
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-01-26 12:22:37 -08:00
Tonis Tiigi
38a45eed88 Fix rmi by ID untagging image on error
Do not untag image if it would later get a hard conflict because of running containers.

Fixes #18873

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-01-12 13:45:40 -08:00
Lei Jitang
0bbc9f1d2d Fix docker rmi trying to remove a being used parent
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-11-26 09:57:20 +08:00
Tonis Tiigi
4352da7803 Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on
the old code in the graph package, with major changes to work with the
new image/layer model.

Add v1 migration code.

Update registry, api/*, and daemon packages to use the reference
package's types where applicable.

Update daemon package to use image/layer/tag stores instead of the graph
package

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-11-24 09:40:25 -08:00
Alexander Morozov
d4a8d09d1a Do not rely on string comparison in truncindex
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-11-04 11:34:05 -08:00
Derek McGowan
48e7f7963e Fix rmi -f removing multiple tags
When an image has multiple tags and rmi is called with force on a tag, only the single tag should be removed.
The current behavior is broken and removes all tags and the image.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-10-28 16:07:02 -07:00
Antonio Murdaca
56f5e3459f graph: add parent img refcount for faster rmi
also fix a typo in pkg/truncindex package comment

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2015-10-21 17:13:45 +02:00
Zhang Wei
c6b02ad73b Update integration test with Assert
Part of #16756

Update integration-cli/docker_cli_rmi_test.go:
Use Assert instead of condition judgement in test.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-10-11 10:56:02 +08:00
John Howard
f9a3558a9d Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-04 12:32:40 -07:00
Josh Hawn
111d2f3487 [daemon] Refactor image_delete.go
This file was not well documented and had very high cyclomatic complexity.
This patch completely rearranges this file and the ImageDelete method to
be easier to follow and more maintainable in the future.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-08-28 11:01:24 -07:00
Brian Goff
693ba98cb9 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-07-27 14:33:32 -04:00
Shijiang Wei
9f7698a637 raise an error if rmi -f with multiple tags and running container
Fixes https://github.com/docker/docker/issues/14116

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-07-24 20:44:13 +08:00
David Calavera
15cb7dfc9e Merge pull request #14578 from mountkin/fix-rmi-image-not-found
don't allow deleting the image of running containers
2015-07-16 18:02:51 -07:00
Hu Keping
71868228c7 Refactor : Use dockerCmd in integration-cli tests
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-07-17 04:07:12 +08:00
Shijiang Wei
ce6410cd4c don't allow deleting the image of running containers
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-07-16 13:14:48 +08:00
Yuan Sun
2179dd00dd Add the expected error verification for TestRmiBlank.
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
2015-07-01 19:34:43 +08:00
Jessica Frazelle
185f392691 fix bug with rmi multiple tag
Signed-off-by: Jessica Frazelle <princess@docker.com>
2015-05-29 14:04:06 -07:00
Lorenzo Fontana
086b514f6a Removed deleteContainer calls
Signed-off-by: Lorenzo Fontana <fontanalorenzo@me.com>
2015-05-20 08:38:23 +02:00
Qiang Huang
74f8a4eca4 Use inspectField to simplify code
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-18 10:06:13 +08:00
David Mackey
3941623fbc trivial: typo cleanup
Signed-off-by: David Mackey <tdmackey@booleanhaiku.com>
2015-04-27 13:35:08 -07:00
Jessica Frazelle
28f5541b72 add regression test for rmi multiple tags without f
Signed-off-by: Jessica Frazelle <princess@docker.com>
2015-04-22 14:23:05 -07:00
Alexander Morozov
dc944ea7e4 Use suite for integration-cli
It prints test name and duration for each test.
Also performs deleteAllContainers after each test.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-04-21 10:28:52 -07:00
bobby abbott
621b601b3c Removed unnecessary error output from dockerCmd
Changed method declaration. Fixed all calls to dockerCmd
method to reflect the change.

resolves #12355

Signed-off-by: bobby abbott <ttobbaybbob@gmail.com>
2015-04-17 09:11:14 -07:00
Deng Guangxing
795a58fb44 'docker rmi -f IMAGE_ID' untag all names and delete the image
If an image has been tagged to multiple repos and tags, 'docker
rmi -f IMAGE_ID' will just untag one random repo instead of
untagging all and deleting the image. This patch implement
this. This commit is composed of:

        *untag all names and delete the image

        *add test to this feature

        *modify commandline/cli.md to explain this

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
2015-04-11 09:24:21 +08:00
Brian Goff
d3fa57e051 Merge pull request #12112 from kostickm/12042-fix-logDone-format
Fixes logDone format
2015-04-06 12:34:38 -04:00
Megan Kostick
d6ada45f45 Closes #12042 - fix logDone format
Signed-off-by: Megan Kostick <mkostick@us.ibm.com>
2015-04-06 08:54:35 -07:00
Brian Goff
475c65319b Remove stripTrailingCharacters from tests
This was just an alias to `strings.TrimSpace`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-06 09:21:18 -04:00
Doug Davis
eeb36c9348 Better error message for "docker rmi ''"
See: https://github.com/docker/docker/issues/10867

While looking at #10867 I noticed that the error message generated for
a blank image ID wasn't very helpful so this fixes that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-03-04 13:21:59 -08:00
Lei Jitang
d9d9175507 Fix docker remover an image show misleading conflicts
due to its dependency is tagged to multiple repositories

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-02-26 12:01:35 +08:00
Ahmet Alp Balkan
70407ce40c Better test cleanup with defer
This fixes a few misuses of `deleteAllContainers()` cleanup
method in integration-cli suite by moving call to the
beginning of the method and guaranteeing their execution
(including panics) with `defer`s.

Also added some forgotten cleanup calls while I'm at it.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-20 14:04:36 -08:00
Ahmet Alp Balkan
57d34241fd integration-cli: fix test to use busybox outside container
Fixes TestRmiForceWithExistingContainers test to make it use
`busybox` image rather than /docker-busybox hardcoded path
and rebuilding image.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-14 03:00:38 -08:00
Jessica Frazelle
02a021119f Remove unnecessary abstraction nLines
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-12-03 17:47:28 -08:00
Daehyeok Mun
7fbbd515b1 remove deprecated cmd function in integration-cli
Remove deprecated cmd function in integration-cli
and change cmd to dockerCmd in all test files

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2014-11-25 00:32:38 +09:00
Jessica Frazelle
a0605107d7 Add test for bug (9056) where rmi -f fails with "no such id".
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-17 15:12:55 -08:00
Doug Davis
0cef21cfba Cleanup some integration-cli output
I noticed a few things that were bugging me in the output
of the integration-cli tests.
- one of the tests used println to stdout so we had garage sent to the screen
- some of the test, in their final log message, didn't include the name of
  the group/file e.g.  daemon - run,iptables   was just   run,iptables

And yes, I noticed this because I'm anal :-)  but also because we should keep
the output of the tests as clean as possible so its easy to spot it when
things go bad.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-11 08:44:32 -08:00
Jessica Frazelle
0e3744ec89 Cleanup errorOut resp in rmi tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-16 15:06:20 -07:00
Victor Vieux
c68e6b15a5 add test and move one from rm to rmi
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-10-02 23:39:39 +00:00
Alexandr Morozov
2e2422b0eb Use prefix naming for rmi tests
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-09-19 22:11:54 +04:00
Jessica Frazelle
b2efdc538d Removing an image that fails, also removes the image name/tag.
Fixes #7845 and #7801, and a real pain point I had :)

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-09-11 11:29:25 -07:00