All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cloud.localstack.docker.command.RunCommand Maven / Gradle / Ivy

There is a newer version: 0.2.23
Show newest version
package cloud.localstack.docker.command;

import java.util.ArrayList;
import java.util.List;

public class RunCommand extends Command {

    private final String imageName;

    public RunCommand(String imageName) {
        this.imageName = imageName;
    }

    public String execute() {
        List args = new ArrayList<>();
        args.add("run");
        args.add("-d");
        args.addAll(options);
        args.add(imageName);

        return dockerExe.execute(args);
    }

    public RunCommand withExposedPorts(String portsToExpose) {
        addOptions("-p", ":" + portsToExpose);
        return this;
    }

    public RunCommand withEnvironmentVariable(String name, String value) {
        addOptions("-e", String.format("\"%s=%s\"", name, value));
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy