import cn.reghao.devops.common.docker.DockerImpl; import com.github.dockerjava.api.model.Container; import org.junit.Test; import java.util.*; import java.util.regex.Pattern; /** * @author reghao * @date 2022-05-07 09:32:40 */ public class DockerTest { @Test public void dockerListTest() { Pattern pattern = Pattern.compile("^\\S*$"); String str = "dfa safd"; String str1 = "dfasafd"; boolean matched = pattern.matcher(str).matches(); System.out.println(); } @Test public void dockerBuildTest() throws Exception { DockerImpl docker = new DockerImpl(); String repoTag = "file:12345678"; String compileHome = "/home/reghao/code/aha/tnb/file/file-service"; docker.build(repoTag, compileHome); } @Test public void dockerTest() { DockerImpl docker = new DockerImpl(); List list = docker.ps(true); list.forEach(container -> { container.getId(); }); } }