Docker Community Forums

Share and learn in the Docker community.

Error invoking nodejs6.10 runtime: Error response from daemon: Minimum memory limit allowed is 4MB


(Ginojohnson) #1

Hello,

I’m running docker for mac and I’m using a docker file. I’m also using a docker-compose file to create a mysql docker instance and a sam local instance on the same bridge network.

I was able to copy over my files to the sam local instance and get the mysql instance up and running.

When I do a docker-compose --build

I would expect sam local to execute just fine when I hit an API endpoint.

Instead I get the following error when I hit any endpoint on the API: Error invoking nodejs6.10 runtime: Error response from daemon: Minimum memory limit allowed is 4MB

when I execute this using sam local without the docker-compose or docker files inside of just my project folder. I don’t get this issue.

From what I can tell, this comes from the underlying linux vm that docker for mac runs. These containers are LXC containers and they require a minimum memory of 4mb.

If I run this image using:

docker run -it --memory-reservation 10000000 -v /var/run/docker.sock:/var/run/docker.sock -p 3000:3000 samlocal

I still get this issue, which is what leads me to believe this is an issue in instantiating new lambda containers within sam local.

I’m not sure if there is a way to modify the hostconfig file for LXC from within the container or if there is some other solution to this problem.

My samlocal dockerfile and docker-compose file’s follow:

DOCKERFILE:

FROM alpine:3.6

ENV VERSION=0.2.4
#version used to be 0.2.2

RUN apk add --no-cache curl &&
curl -sSLO https://github.com/awslabs/aws-sam-local/releases/download/v${VERSION}/sam_${VERSION}linux_386.tar.gz &&
tar -C /usr/local/bin -zxvf /sam
${VERSION}linux_386.tar.gz &&
apk del curl &&
rm -f /sam${VERSION}_linux_386.tar.gz

awscli for “sam package” and "sam deploy"
RUN apk add --no-cache py-pip && pip install awscli

WORKDIR /var/opt

EXPOSE 3000

#might need to add the full directory to docker so that it can execute the other code
#used to be COPY template.yml template.yml
COPY . .

ENTRYPOINT ["/usr/local/bin/sam"]
CMD [“local”,“start-api”,"–host", “0.0.0.0”,"–docker-volume-basedir", “/1725_ecpo_lambda”]

DOCKER-COMPOSE FILE:

version: "3"
services:

samlocal:
build:
context: ./
dockerfile: sam-local-docker.dockerfile
ports:

  • "3000:3000"
    volumes:
  • /var/run/docker.sock:/var/run/docker.sock
    networks:
  • backend

db:
build:
context: ./
dockerfile: mysql-docker.dockerfile
ports:

  • 3306:3306
    volumes:
  • db-data:/var/lib/mysql
  • /var/run/docker.sock:/var/run/docker.sock
    networks:
  • backend

networks:
backend:

volumes:
db-data: