diff mbox series

docker.py: always use --rm

Message ID 20200917104441.31738-1-pbonzini@redhat.com
State New
Headers show
Series docker.py: always use --rm | expand

Commit Message

Paolo Bonzini Sept. 17, 2020, 10:44 a.m. UTC
Avoid that containers pile up.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/docker/Makefile.include | 1 -
 tests/docker/docker.py        | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Daniel P. Berrangé Sept. 17, 2020, 10:48 a.m. UTC | #1
On Thu, Sep 17, 2020 at 12:44:41PM +0200, Paolo Bonzini wrote:
> Avoid that containers pile up.

> 

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> ---

>  tests/docker/Makefile.include | 1 -

>  tests/docker/docker.py        | 4 ++--

>  2 files changed, 2 insertions(+), 3 deletions(-)

> 

> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

> index 3daabaa2fd..75704268ff 100644

> --- a/tests/docker/Makefile.include

> +++ b/tests/docker/Makefile.include

> @@ -243,7 +243,6 @@ docker-run: docker-qemu-src

>  		$(DOCKER_SCRIPT) run 					\

>  			$(if $(NOUSER),,--run-as-current-user) 		\

>  			--security-opt seccomp=unconfined		\

> -			$(if $V,,--rm) 					\


I guess the intention was that if someone is running verbose they might
want to get back into the container after a failure. This is certainly
a pain for CI though, because running verbose is desirable but keeping
around dead containers is not.

The DEBUG=1 option is likely a better general purpose debugging approach
than relying on the dead container being left behind, so

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>



>  			$(if $(DEBUG),-ti,)				\

>  			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \

>  			-e TARGET_LIST=$(subst $(SPACE),$(COMMA),$(TARGET_LIST))	\

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index 356d7618f1..36b7868406 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -377,7 +377,7 @@ class Docker(object):

>              if self._command[0] == "podman":

>                  cmd.insert(0, '--userns=keep-id')

>  

> -        ret = self._do_check(["run", "--label",

> +        ret = self._do_check(["run", "--rm", "--label",

>                               "com.qemu.instance.uuid=" + label] + cmd,

>                               quiet=quiet)

>          if not keep:

> @@ -616,7 +616,7 @@ class CcCommand(SubCommand):

>          if argv and argv[0] == "--":

>              argv = argv[1:]

>          cwd = os.getcwd()

> -        cmd = ["--rm", "-w", cwd,

> +        cmd = ["-w", cwd,

>                 "-v", "%s:%s:rw" % (cwd, cwd)]

>          if args.paths:

>              for p in args.paths:

> -- 

> 2.26.2

> 


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
no-reply@patchew.org Sept. 17, 2020, 10:48 a.m. UTC | #2
Patchew URL: https://patchew.org/QEMU/20200917104441.31738-1-pbonzini@redhat.com/



Hi,

This series failed build test on FreeBSD host. Please find the details below.






The full log is available at
http://patchew.org/logs/20200917104441.31738-1-pbonzini@redhat.com/testing.FreeBSD/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
no-reply@patchew.org Sept. 17, 2020, 10:49 a.m. UTC | #3
Patchew URL: https://patchew.org/QEMU/20200917104441.31738-1-pbonzini@redhat.com/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.






The full log is available at
http://patchew.org/logs/20200917104441.31738-1-pbonzini@redhat.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Paolo Bonzini Sept. 17, 2020, 10:49 a.m. UTC | #4
On 17/09/20 12:48, Daniel P. Berrangé wrote:
> On Thu, Sep 17, 2020 at 12:44:41PM +0200, Paolo Bonzini wrote:

>> Avoid that containers pile up.

>>

>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

>> ---

>>  tests/docker/Makefile.include | 1 -

>>  tests/docker/docker.py        | 4 ++--

>>  2 files changed, 2 insertions(+), 3 deletions(-)

>>

>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

>> index 3daabaa2fd..75704268ff 100644

>> --- a/tests/docker/Makefile.include

>> +++ b/tests/docker/Makefile.include

>> @@ -243,7 +243,6 @@ docker-run: docker-qemu-src

>>  		$(DOCKER_SCRIPT) run 					\

>>  			$(if $(NOUSER),,--run-as-current-user) 		\

>>  			--security-opt seccomp=unconfined		\

>> -			$(if $V,,--rm) 					\

> 

> I guess the intention was that if someone is running verbose they might

> want to get back into the container after a failure. This is certainly

> a pain for CI though, because running verbose is desirable but keeping

> around dead containers is not.

> 

> The DEBUG=1 option is likely a better general purpose debugging approach

> than relying on the dead container being left behind, so

> 

> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Peter, can you apply this directly in order to unbreak Patchew?

Paolo

> 

> 

>>  			$(if $(DEBUG),-ti,)				\

>>  			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \

>>  			-e TARGET_LIST=$(subst $(SPACE),$(COMMA),$(TARGET_LIST))	\

>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

>> index 356d7618f1..36b7868406 100755

>> --- a/tests/docker/docker.py

>> +++ b/tests/docker/docker.py

>> @@ -377,7 +377,7 @@ class Docker(object):

>>              if self._command[0] == "podman":

>>                  cmd.insert(0, '--userns=keep-id')

>>  

>> -        ret = self._do_check(["run", "--label",

>> +        ret = self._do_check(["run", "--rm", "--label",

>>                               "com.qemu.instance.uuid=" + label] + cmd,

>>                               quiet=quiet)

>>          if not keep:

>> @@ -616,7 +616,7 @@ class CcCommand(SubCommand):

>>          if argv and argv[0] == "--":

>>              argv = argv[1:]

>>          cwd = os.getcwd()

>> -        cmd = ["--rm", "-w", cwd,

>> +        cmd = ["-w", cwd,

>>                 "-v", "%s:%s:rw" % (cwd, cwd)]

>>          if args.paths:

>>              for p in args.paths:

>> -- 

>> 2.26.2

>>

> 

> Regards,

> Daniel

>
Philippe Mathieu-Daudé Sept. 17, 2020, 1:38 p.m. UTC | #5
On 9/17/20 12:44 PM, Paolo Bonzini wrote:
> Avoid that containers pile up.

> 

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> ---

>  tests/docker/Makefile.include | 1 -

>  tests/docker/docker.py        | 4 ++--

>  2 files changed, 2 insertions(+), 3 deletions(-)

> 

> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

> index 3daabaa2fd..75704268ff 100644

> --- a/tests/docker/Makefile.include

> +++ b/tests/docker/Makefile.include

> @@ -243,7 +243,6 @@ docker-run: docker-qemu-src

>  		$(DOCKER_SCRIPT) run 					\

>  			$(if $(NOUSER),,--run-as-current-user) 		\

>  			--security-opt seccomp=unconfined		\

> -			$(if $V,,--rm) 					\

>  			$(if $(DEBUG),-ti,)				\


Alternatively:

-                       $(if $V,,--rm)
-                       $(if $(DEBUG),-ti,)
+                       $(if $(DEBUG),-ti,--rm)

Anyhow:
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


>  			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \

>  			-e TARGET_LIST=$(subst $(SPACE),$(COMMA),$(TARGET_LIST))	\

> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

> index 356d7618f1..36b7868406 100755

> --- a/tests/docker/docker.py

> +++ b/tests/docker/docker.py

> @@ -377,7 +377,7 @@ class Docker(object):

>              if self._command[0] == "podman":

>                  cmd.insert(0, '--userns=keep-id')

>  

> -        ret = self._do_check(["run", "--label",

> +        ret = self._do_check(["run", "--rm", "--label",

>                               "com.qemu.instance.uuid=" + label] + cmd,

>                               quiet=quiet)

>          if not keep:

> @@ -616,7 +616,7 @@ class CcCommand(SubCommand):

>          if argv and argv[0] == "--":

>              argv = argv[1:]

>          cwd = os.getcwd()

> -        cmd = ["--rm", "-w", cwd,

> +        cmd = ["-w", cwd,

>                 "-v", "%s:%s:rw" % (cwd, cwd)]

>          if args.paths:

>              for p in args.paths:

>
Alex Bennée Sept. 17, 2020, 4:52 p.m. UTC | #6
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> On 9/17/20 12:44 PM, Paolo Bonzini wrote:

>> Avoid that containers pile up.

>> 

>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

>> ---

>>  tests/docker/Makefile.include | 1 -

>>  tests/docker/docker.py        | 4 ++--

>>  2 files changed, 2 insertions(+), 3 deletions(-)

>> 

>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

>> index 3daabaa2fd..75704268ff 100644

>> --- a/tests/docker/Makefile.include

>> +++ b/tests/docker/Makefile.include

>> @@ -243,7 +243,6 @@ docker-run: docker-qemu-src

>>  		$(DOCKER_SCRIPT) run 					\

>>  			$(if $(NOUSER),,--run-as-current-user) 		\

>>  			--security-opt seccomp=unconfined		\

>> -			$(if $V,,--rm) 					\

>>  			$(if $(DEBUG),-ti,)				\

>

> Alternatively:

>

> -                       $(if $V,,--rm)

> -                       $(if $(DEBUG),-ti,)

> +                       $(if $(DEBUG),-ti,--rm)


Surely that should b:

  $(if $(DEBUG),-ti --rm,)

I think being able to keep the container around is useful for debug, I
have no problem with changing the behaviour for V=1.

>

> Anyhow:

> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>

>>  			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \

>>  			-e TARGET_LIST=$(subst $(SPACE),$(COMMA),$(TARGET_LIST))	\

>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py

>> index 356d7618f1..36b7868406 100755

>> --- a/tests/docker/docker.py

>> +++ b/tests/docker/docker.py

>> @@ -377,7 +377,7 @@ class Docker(object):

>>              if self._command[0] == "podman":

>>                  cmd.insert(0, '--userns=keep-id')

>>  

>> -        ret = self._do_check(["run", "--label",

>> +        ret = self._do_check(["run", "--rm", "--label",

>>                               "com.qemu.instance.uuid=" + label] + cmd,

>>                               quiet=quiet)

>>          if not keep:

>> @@ -616,7 +616,7 @@ class CcCommand(SubCommand):

>>          if argv and argv[0] == "--":

>>              argv = argv[1:]

>>          cwd = os.getcwd()

>> -        cmd = ["--rm", "-w", cwd,

>> +        cmd = ["-w", cwd,

>>                 "-v", "%s:%s:rw" % (cwd, cwd)]

>>          if args.paths:

>>              for p in args.paths:

>> 



-- 
Alex Bennée
Paolo Bonzini Sept. 17, 2020, 4:58 p.m. UTC | #7
Il gio 17 set 2020, 18:53 Alex Bennée <alex.bennee@linaro.org> ha scritto:

>

> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

>

> > On 9/17/20 12:44 PM, Paolo Bonzini wrote:

> >> Avoid that containers pile up.

> >>

> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> >> ---

> >>  tests/docker/Makefile.include | 1 -

> >>  tests/docker/docker.py        | 4 ++--

> >>  2 files changed, 2 insertions(+), 3 deletions(-)

> >>

> >> diff --git a/tests/docker/Makefile.include

> b/tests/docker/Makefile.include

> >> index 3daabaa2fd..75704268ff 100644

> >> --- a/tests/docker/Makefile.include

> >> +++ b/tests/docker/Makefile.include

> >> @@ -243,7 +243,6 @@ docker-run: docker-qemu-src

> >>              $(DOCKER_SCRIPT) run                                    \

> >>                      $(if $(NOUSER),,--run-as-current-user)          \

> >>                      --security-opt seccomp=unconfined               \

> >> -                    $(if $V,,--rm)                                  \

> >>                      $(if $(DEBUG),-ti,)                             \

> >

> > Alternatively:

> >

> > -                       $(if $V,,--rm)

> > -                       $(if $(DEBUG),-ti,)

> > +                       $(if $(DEBUG),-ti,--rm)

>

> Surely that should b:

>

>   $(if $(DEBUG),-ti --rm,)

>

> I think being able to keep the container around is useful for debug, I

> have no problem with changing the behaviour for V=1.

>


You probably mean  $(if $(DEBUG),-ti,--rm) but that would not work because
the patch adds --rm unconditionally in docker.py. But $(DEBUG) gives you a
shell to run the test from, so I don't think skipping --rm is useful even
in the $(DEBUG) case.

Paolo

>
<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il gio 17 set 2020, 18:53 Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org">alex.bennee@linaro.org</a>&gt; ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Philippe Mathieu-Daudé &lt;<a href="mailto:f4bug@amsat.org" target="_blank" rel="noreferrer">f4bug@amsat.org</a>&gt; writes:<br>
<br>
&gt; On 9/17/20 12:44 PM, Paolo Bonzini wrote:<br>
&gt;&gt; Avoid that containers pile up.<br>
&gt;&gt; <br>
&gt;&gt; Signed-off-by: Paolo Bonzini &lt;<a href="mailto:pbonzini@redhat.com" target="_blank" rel="noreferrer">pbonzini@redhat.com</a>&gt;<br>
&gt;&gt; ---<br>
&gt;&gt;  tests/docker/Makefile.include | 1 -<br>
&gt;&gt;  tests/docker/docker.py        | 4 ++--<br>
&gt;&gt;  2 files changed, 2 insertions(+), 3 deletions(-)<br>
&gt;&gt; <br>
&gt;&gt; diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include<br>
&gt;&gt; index 3daabaa2fd..75704268ff 100644<br>
&gt;&gt; --- a/tests/docker/Makefile.include<br>
&gt;&gt; +++ b/tests/docker/Makefile.include<br>
&gt;&gt; @@ -243,7 +243,6 @@ docker-run: docker-qemu-src<br>
&gt;&gt;              $(DOCKER_SCRIPT) run                                    \<br>
&gt;&gt;                      $(if $(NOUSER),,--run-as-current-user)          \<br>
&gt;&gt;                      --security-opt seccomp=unconfined               \<br>
&gt;&gt; -                    $(if $V,,--rm)                                  \<br>
&gt;&gt;                      $(if $(DEBUG),-ti,)                             \<br>
&gt;<br>
&gt; Alternatively:<br>
&gt;<br>
&gt; -                       $(if $V,,--rm)<br>
&gt; -                       $(if $(DEBUG),-ti,)<br>
&gt; +                       $(if $(DEBUG),-ti,--rm)<br>
<br>
Surely that should b:<br>
<br>
  $(if $(DEBUG),-ti --rm,)<br>
<br>
I think being able to keep the container around is useful for debug, I<br>
have no problem with changing the behaviour for V=1.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">You probably mean  $(if $(DEBUG),-ti,--rm) but that would not work because the patch adds --rm unconditionally in docker.py. But $(DEBUG) gives you a shell to run the test from, so I don&#39;t think skipping --rm is useful even in the $(DEBUG) case.</div><div dir="auto"><br></div><div dir="auto">Paolo</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
Alex Bennée Sept. 17, 2020, 6:50 p.m. UTC | #8
Got it.

On Thu, 17 Sep 2020, 17:58 Paolo Bonzini, <pbonzini@redhat.com> wrote:

>

>

> Il gio 17 set 2020, 18:53 Alex Bennée <alex.bennee@linaro.org> ha scritto:

>

>>

>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

>>

>> > On 9/17/20 12:44 PM, Paolo Bonzini wrote:

>> >> Avoid that containers pile up.

>> >>

>> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

>> >> ---

>> >>  tests/docker/Makefile.include | 1 -

>> >>  tests/docker/docker.py        | 4 ++--

>> >>  2 files changed, 2 insertions(+), 3 deletions(-)

>> >>

>> >> diff --git a/tests/docker/Makefile.include

>> b/tests/docker/Makefile.include

>> >> index 3daabaa2fd..75704268ff 100644

>> >> --- a/tests/docker/Makefile.include

>> >> +++ b/tests/docker/Makefile.include

>> >> @@ -243,7 +243,6 @@ docker-run: docker-qemu-src

>> >>              $(DOCKER_SCRIPT) run                                    \

>> >>                      $(if $(NOUSER),,--run-as-current-user)          \

>> >>                      --security-opt seccomp=unconfined               \

>> >> -                    $(if $V,,--rm)                                  \

>> >>                      $(if $(DEBUG),-ti,)                             \

>> >

>> > Alternatively:

>> >

>> > -                       $(if $V,,--rm)

>> > -                       $(if $(DEBUG),-ti,)

>> > +                       $(if $(DEBUG),-ti,--rm)

>>

>> Surely that should b:

>>

>>   $(if $(DEBUG),-ti --rm,)

>>

>> I think being able to keep the container around is useful for debug, I

>> have no problem with changing the behaviour for V=1.

>>

>

> You probably mean  $(if $(DEBUG),-ti,--rm) but that would not work because

> the patch adds --rm unconditionally in docker.py. But $(DEBUG) gives you a

> shell to run the test from, so I don't think skipping --rm is useful even

> in the $(DEBUG) case.

>

> Paolo

>

>>
<div dir="auto">Got it. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 17 Sep 2020, 17:58 Paolo Bonzini, &lt;<a href="mailto:pbonzini@redhat.com">pbonzini@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il gio 17 set 2020, 18:53 Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org" target="_blank" rel="noreferrer">alex.bennee@linaro.org</a>&gt; ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Philippe Mathieu-Daudé &lt;<a href="mailto:f4bug@amsat.org" rel="noreferrer noreferrer" target="_blank">f4bug@amsat.org</a>&gt; writes:<br>
<br>
&gt; On 9/17/20 12:44 PM, Paolo Bonzini wrote:<br>
&gt;&gt; Avoid that containers pile up.<br>
&gt;&gt; <br>
&gt;&gt; Signed-off-by: Paolo Bonzini &lt;<a href="mailto:pbonzini@redhat.com" rel="noreferrer noreferrer" target="_blank">pbonzini@redhat.com</a>&gt;<br>
&gt;&gt; ---<br>
&gt;&gt;  tests/docker/Makefile.include | 1 -<br>
&gt;&gt;  tests/docker/docker.py        | 4 ++--<br>
&gt;&gt;  2 files changed, 2 insertions(+), 3 deletions(-)<br>
&gt;&gt; <br>
&gt;&gt; diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include<br>
&gt;&gt; index 3daabaa2fd..75704268ff 100644<br>
&gt;&gt; --- a/tests/docker/Makefile.include<br>
&gt;&gt; +++ b/tests/docker/Makefile.include<br>
&gt;&gt; @@ -243,7 +243,6 @@ docker-run: docker-qemu-src<br>
&gt;&gt;              $(DOCKER_SCRIPT) run                                    \<br>
&gt;&gt;                      $(if $(NOUSER),,--run-as-current-user)          \<br>
&gt;&gt;                      --security-opt seccomp=unconfined               \<br>
&gt;&gt; -                    $(if $V,,--rm)                                  \<br>
&gt;&gt;                      $(if $(DEBUG),-ti,)                             \<br>
&gt;<br>
&gt; Alternatively:<br>
&gt;<br>
&gt; -                       $(if $V,,--rm)<br>
&gt; -                       $(if $(DEBUG),-ti,)<br>
&gt; +                       $(if $(DEBUG),-ti,--rm)<br>
<br>
Surely that should b:<br>
<br>
  $(if $(DEBUG),-ti --rm,)<br>
<br>
I think being able to keep the container around is useful for debug, I<br>
have no problem with changing the behaviour for V=1.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">You probably mean  $(if $(DEBUG),-ti,--rm) but that would not work because the patch adds --rm unconditionally in docker.py. But $(DEBUG) gives you a shell to run the test from, so I don&#39;t think skipping --rm is useful even in the $(DEBUG) case.</div><div dir="auto"><br></div><div dir="auto">Paolo</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div>
Peter Maydell Sept. 18, 2020, 12:36 p.m. UTC | #9
On Thu, 17 Sep 2020 at 11:45, Paolo Bonzini <pbonzini@redhat.com> wrote:
>

> Avoid that containers pile up.

>

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> ---

>  tests/docker/Makefile.include | 1 -

>  tests/docker/docker.py        | 4 ++--

>  2 files changed, 2 insertions(+), 3 deletions(-)


Applied to master, thanks.

-- PMM
diff mbox series

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 3daabaa2fd..75704268ff 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -243,7 +243,6 @@  docker-run: docker-qemu-src
 		$(DOCKER_SCRIPT) run 					\
 			$(if $(NOUSER),,--run-as-current-user) 		\
 			--security-opt seccomp=unconfined		\
-			$(if $V,,--rm) 					\
 			$(if $(DEBUG),-ti,)				\
 			$(if $(NETWORK),$(if $(subst $(NETWORK),,1),--net=$(NETWORK)),--net=none) \
 			-e TARGET_LIST=$(subst $(SPACE),$(COMMA),$(TARGET_LIST))	\
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 356d7618f1..36b7868406 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -377,7 +377,7 @@  class Docker(object):
             if self._command[0] == "podman":
                 cmd.insert(0, '--userns=keep-id')
 
-        ret = self._do_check(["run", "--label",
+        ret = self._do_check(["run", "--rm", "--label",
                              "com.qemu.instance.uuid=" + label] + cmd,
                              quiet=quiet)
         if not keep:
@@ -616,7 +616,7 @@  class CcCommand(SubCommand):
         if argv and argv[0] == "--":
             argv = argv[1:]
         cwd = os.getcwd()
-        cmd = ["--rm", "-w", cwd,
+        cmd = ["-w", cwd,
                "-v", "%s:%s:rw" % (cwd, cwd)]
         if args.paths:
             for p in args.paths: