Skip to content

Skip prompting for Dockerfile if Docker Engine is not running #1814

@efekarakus

Description

@efekarakus

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"
  ],
  ...
}

Metadata

Metadata

Assignees

Labels

size/MWe should be able to deliver roughly 1 medium issue in a sprint.type/enhancementIssues that are improvements for existing features.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions