Background
Currently Copilot prompts for which Dockerfile to use while running copilot svc init or copilot job init:
Which *Dockerfile* would you like to use for my-svc?
> ./Dockerfile
Enter a custom path for your Dockerfile
Use an existing image instead
Ask
Instead, it'd be nice if Copilot can detect if Docker Engine is running or not and filter the options accordingly, for example we can log a statement and immediately jump to using an existing image instead:
Docker Engine is not running, Copilot won't build from a Dockerfile: docker: command not found
What's the location of the image to use? nginx
Proposed programming model
One possible way to tell if the daemon is running or not is by running docker info -f '{{json . }}' and printing the error that we receive. For example, if docker is not installed:
$ docker info -f '{{json . }}'
bash: docker: command not found
Or if the daemon is not running:
$ docker info -f '{{json . }}'
{
"ServerErrors": [
"Error response from daemon: dial unix docker.raw.sock: connect: connection refused"
],
...
}
Background
Currently Copilot prompts for which Dockerfile to use while running
copilot svc initorcopilot job init:Ask
Instead, it'd be nice if Copilot can detect if Docker Engine is running or not and filter the options accordingly, for example we can log a statement and immediately jump to using an existing image instead:
Proposed programming model
One possible way to tell if the daemon is running or not is by running
docker info -f '{{json . }}'and printing the error that we receive. For example, if docker is not installed:Or if the daemon is not running: