Docker-java: How to run a container with --rm flag?

Created on 27 Apr 2020  路  4Comments  路  Source: docker-java/docker-java

Hello!

Is it possible to run a container with --rm flag, using docker-java?

https://docs.docker.com/engine/reference/run/#clean-up---rm

typquestion

All 4 comments

Docker api has no --rm you need control start/stop/delete lifecycle yourself in client

Hi!

According to this StackOverflow answer "--rm" has been moved to daemon side meaning that it should be accessible through the docker API. So it would make things a lot easier if it were implemented in this project.

https://stackoverflow.com/questions/24764197/how-can-i-run-containers-detached-and-have-them-automatically-removed-when-they

See HostConfig#withAutoRemove :)

Thanks, I have been playing around since yesterday couldn't get it to work, just realized that I was compiling old code.

Was this page helpful?
0 / 5 - 0 ratings