简体   繁体   中英

Python error in serverless framework stating - Serverless Error: spawn docker ENOENT

Error:

Running "serverless" from node_modules

Deploying serverless-flask to stage dev (us-east-1)

✖ Stack serverless-flask-dev failed to deploy (0s)
Environment: darwin, node 16.0.0, framework 3.1.1 (local) 3.1.1v (global), plugin 6.0.0, SDK 4.3.1
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: spawn docker ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

I'm following these instructions ( https://www.serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/ ) and can't seem to figure this out since the base app is in python and not javascript... most people who have solved this solved it using javascript.

To be able to deploy your project with serverless-python-requirements you need to have docker on your machine (if you are on windows consider using docker desktop or a linux vm)

Why do I need Docker?

When you do a sls deploy , serverless-python-requirements launch a docker container to install all the dependencies you've put in your requirements.txt file that will be used during the deployement process

You are getting this error because your container is not launch correctly

To solve this issue you need to update your serverless.yml file with these changes in the custom block

custom:
  pythonRequirements:
  pythonBin: python3
  dockerizePip: "false"

I also face the same issue my issue was with dockerizePip it was set to

dockerizePip: non-linux

either remove this entry from serverless.yml file or just set it to false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM