Can't get my Dockerized Adonis app to answer


#1

(Solved: change the HOST in the .env file to 0.0.0.0 when running in Docker)

I’ve an Adonis app that works fine from the command line via: npm start

I’ve Dockerized it but it returns no data – it connects, but the return is empty

I hope someone can tell me what I’m doing wrong…

I’m using Docker Desktop (Mac, OSX 10.14.3)

curl http://localhost:3333
curl: (52) Empty reply from server

My docker build command & dockerfile

docker build -f builder_Dockerfile --rm -t touch-screen/builder builderTouchScreenManager

FROM node:10.14.0
WORKDIR /
COPY . .
ARG PORT=3333
EXPOSE ${PORT}
CMD ["npm","start"]
USER node

the docker run command & output:

docker run --init -it -p 3333:3333 --rm --name tsb touch-screen/builder

> adonis-fullstack-app@4.1.0 start /
> node server.js

info: serving app on http://127.0.0.1:3333

when it’s running normally the output is:

curl http://localhost:3333
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>TouchScreen-Builder</title>
</head>
<body>
  <p>TouchScreen-Builder</p>

  <p>This product only supports API access</p>

  <p>see: /api</p>
</body>
</html>

#2

You are running you app on the localhost in the container which it is a different network.
Trying to change the .env file with host 0.0.0.0 and restart the app inside the container.