Closed
Description
From #1050 it seems support for AutoRemove was added and commit 0f4647d
was merged, however setting this value in HostConfig does not seem to populate the AutoRemove field in the container.
ExposedPort tcp22 = ExposedPort.tcp(22);
ExposedPort tcp23 = ExposedPort.tcp(23);
Ports portBindings = new Ports();
portBindings.bind(tcp22, Binding.bindPort(baseport + 22));
portBindings.bind(tcp23, Binding.bindPort(baseport + 23));
portBindings.bind(tcp23, Binding.bindPort(baseport + 24));
CreateContainerCmd createContainerCmd = dockerClient.Client()
.createContainerCmd("testimage")
.withHostConfig(new HostConfig()
.withPortBindings(portBindings)
.withAutoRemove(true));
createContainerCmd.exec();
Relevant section taken from docker inspect. Other fields, such as port bindings, are properly populated, but not the AutoRemove field.
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"22/tcp": [
{
"HostIp": "",
"HostPort": "8042"
}
],
"23/tcp": [
{
"HostIp": "",
"HostPort": "8043"
},
{
"HostIp": "",
"HostPort": "8044"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
...
Also, I don't believe there is any test coverage for this particular feature.