When user supplies external Docker image or Dockerfile, validate them.
We try to emulate the standard Docker CLI's image handling. Thus, if user specifies an image like 'ubuntu', we turn that into 'ubuntu:latest'. If user does not supply a registry host, we try 'registry.hub.docker.com'. If they do not specify a registry host or specify a registry host that is either registry-1.docker.io or registry.hub.docker.com, and their image does not contain a /, we prepend 'library/' to it (I *think* this is the right heuristic, but it's inference). For Dockerfiles, we must be able to download it, and it must contain a line matching ^\s*FROM (i.e. a valid FROM instruction, which all Dockerfiles must have). We try to support DOS-mode textfiles too, but only ASCII. Might need to loosen these checks.
Showing with 167 additions and 1 deletion