Cześć.
Zrobiłem bardzo prosty program:
import * as http from 'http';
http.createServer((request, response)=> {
response.writeHead(200, {
'Content-Type': 'text/plain'
});
response.end(
`Hello!
My name is Rajesh and I'm here to help you with all of your issues.`)
}).listen(8080, '127.0.0.1');
Dockerfile:
FROM node:latest
WORKDIR /usr/src
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD [ "node", "serwer.js" ]
I puściłem komendy:
docker build . -t adam/node_docker ; docker run -d -p 1236:8080 -t adam/node_docker
Po wpisaniu w przeglądarkę: 127.0.0.1:1236 dostaję komunikat:
"Przerwane połączenie"
Czy wiecie co zrobiłem nie tak?