Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent Docker from removing intermediate containers when executing RUN command?

The error I'm experiencing is that I want to execute the command "change directory" in my Docker machine, but every time I execute RUN instruction in my Dockerfile, it deletes the actual container (intermediate container).

DOCKERFILE

enter image description here

This happens when I execute the Dockerfile from above

enter image description here

How can I prevent Docker from doing that?

like image 212
Antonio Sanchez Avatar asked Feb 04 '26 12:02

Antonio Sanchez


1 Answers

docker build --rm=false

Remove intermediate containers after a successful build (default true)

like image 105
Ganj Khani Avatar answered Feb 07 '26 03:02

Ganj Khani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!