Skip to content

Commit

Permalink
Merge pull request #710 from molgenis/feat/autostart-using-docker
Browse files Browse the repository at this point in the history
feat: add restart policy for Docker containers
  • Loading branch information
clemens-tolboom authored Mar 19, 2024
2 parents f90fe1d + c8e606e commit 32bcab0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.HostConfig;
import com.github.dockerjava.api.model.Ports;
import com.github.dockerjava.api.model.RestartPolicy;
import jakarta.ws.rs.ProcessingException;
import java.net.SocketException;
import java.util.List;
Expand Down Expand Up @@ -158,7 +159,10 @@ private void installImage(ProfileConfig profileConfig) {
portBindings.bind(exposed, Ports.Binding.bindPort(profileConfig.getPort()));
try (CreateContainerCmd cmd = dockerClient.createContainerCmd(profileConfig.getImage())) {
cmd.withExposedPorts(exposed)
.withHostConfig(new HostConfig().withPortBindings(portBindings))
.withHostConfig(
new HostConfig()
.withPortBindings(portBindings)
.withRestartPolicy(RestartPolicy.unlessStoppedRestart()))
.withName(profileConfig.getName())
.withEnv("DEBUG=FALSE")
.exec();
Expand Down

0 comments on commit 32bcab0

Please sign in to comment.