Open OscarVanL opened 5 years ago
I was thinking of adding some kind of check at
if (samOptions.buildInContainer) {
commandLine.withParameters("--use-container")
}
in LambdaBuilder.kt and if that check doesn't pass, then give an informative error message.
It would need to be checked just before SAM build to ensure the user hasn't closed it (since checking the box).
(I also need to check if Docker Desktop must be open when you right click template.yaml and deploy serverless application inside a docker container, and if so, does this case also get handled by an addition here).
A way of verifying if Docker is running is the CLI command docker info
, which returns exit code 1 if not running, or exit code 0 if running/working.
This would, however, require that the user has docker
in their system PATH. Although this may be a prerequisite that AWS SAM CLI already requires, so perhaps this isn't an issue. I should investigate if SAM works if docker is installed but not in the system PATH.
This should probably be fixed at the SAM CLI layer by providing better error messages.
Sure, I'll make an issue there instead.
Describe the bug
I tried running my Lambda function locally this morning and was greeted with this cryptic error.
This turned out to be because Docker Desktop was not running and I have the
Build function inside a container
checkbox set.I started Docker Desktop, and continually tried running the function. Interestingly, only if Docker is in the process of starting, do you get an informative error message:
To reproduce
Expected behavior
The informative error is shown all the time, it would have helped me this morning :)
Screenshots
N/A
Your Environment
Additional context
Docker Desktop Version: 2.1.0.1