class DockerStatus { final bool installed; final bool running; final String version; DockerStatus(this.installed, this.running, this.version); } class DockerContainer { final String id; final String name; final String image; final String state; // running | exited | created | paused | restarting | dead final String status; // e.g. "Up 2 hours" / "Exited (0) 3 min ago" final String ports; DockerContainer({ required this.id, required this.name, required this.image, required this.state, required this.status, required this.ports, }); bool get up => state.toLowerCase() == 'running'; } /// Everything needed to `docker run` a new container. class DockerRunSpec { String image; String name; String ports; // "host:container" per line String env; // "KEY=VALUE" per line String volumes; // "host:container" per line String restart; // no | on-failure | always | unless-stopped bool detached; String command; DockerRunSpec({ this.image = '', this.name = '', this.ports = '', this.env = '', this.volumes = '', this.restart = 'unless-stopped', this.detached = true, this.command = '', }); List _lines(String s) => s.split('\n').map((e) => e.trim()).where((e) => e.isNotEmpty).toList(); List get portList => _lines(ports); List get envList => _lines(env); List get volumeList => _lines(volumes); }