I wrote the frontend application with react. But the application I wrote does not work in the container.
I found the reason causing stack overflow. So, I found it to be related to the use of ram.
How can I use the command structure at the address below in my docker-container? Does the structure in the link I gave solve the problem? can you help me ?
Node.js: what is ENOSPC error and how to solve?
Does increasing the container ram limit solve the problem?
Could you help ?
Dockerfile.dev
FROM node:alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start"]
docker-compose.yml
version: '3'
services:
nginxproxy:
build:
context: .
dockerfile: Dockerfile.lets
container_name: nginxproxy
networks:
- nginx_network
restart: always
expose:
- 80
ports:
- "443:443"
- "80:80"
environment:
DOMAIN: mySite.com
EMAIL: mymailaddress@hotmail.com
RENEW_INTERVAL: 12h
volumes:
- ./certificates:/usr/share/nginx/certificates
- ./default.conf:/etc/nginx/conf.d/default.conf
web:
build:
context: .
dockerfile: Dockerfile.dev
container_name: web
networks:
- nginx_network
expose:
- 3000
ports:
- "3000:3000"
depends_on:
- nginxproxy
volumes:
- /app/node_modules
- .:/app
tests:
build:
context: .
dockerfile: Dockerfile.dev
container_name: tests
volumes:
- /app/node_modules
- .:/app
command: ["npm","run","test"]
networks:
nginx_network:
driver: bridge
result
root@docker-frontend:~/frontend# docker-compose up
Creating network "frontend_nginx_network" with driver "bridge"
Creating network "frontend_default" with the default driver
Creating nginxproxy ... done
Creating tests ... done
Creating web ... done
Attaching to nginxproxy, web, tests
nginxproxy | Generating RSA private key, 4096 bit long modulus (2 primes)
nginxproxy | .................................++++
nginxproxy | .......................................++++
nginxproxy | e is 65537 (0x010001)
nginxproxy | ./nginx-letsencrypt: line 13: sl: not found
nginxproxy | req: Skipping unknown attribute "EMAIL"
nginxproxy | Signature ok
nginxproxy | subject=C = PT, ST = World, L = World, O = mySite.com, OU = mySite, CN = mySite.com
nginxproxy | Getting Private key
nginxproxy | Setting up watches.
nginxproxy | Watches established.
nginxproxy | 2020/05/02 20:06:16 [emerg] 11#11: host not found in upstream "web:3000" in /etc/nginx/conf.d/default.conf:2
nginxproxy | nginx: [emerg] host not found in upstream "web:3000" in /etc/nginx/conf.d/default.conf:2
web |
web | > customerfollow@1.0.0 start /app
web | > react-scripts start
web |
tests |
tests | > customerfollow@1.0.0 test /app
tests | > react-scripts test
tests |
tests | No tests found, exiting with code 0
tests |
web | [HPM] Proxy created: /api/token/ -> http://localhost:8000/
web | ℹ 「wds」: Project is running at http://172.20.0.3/
web | ℹ 「wds」: webpack output is served from
web | ℹ 「wds」: Content not from webpack is served from /app/public
web | ℹ 「wds」: 404s will fallback to /
web | Starting the development server...
web |
web exited with code 0
root@docker-frontend:~/frontend# docker container ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f6cc62675057 frontend_web "docker-entrypoint.s…" 22 minutes ago Exited (0) 22 minutes ago web
ff958840aa9f frontend_tests "docker-entrypoint.s…" 22 minutes ago Up 22 minutes 3000/tcp tests
05a292cc63e3 frontend_nginxproxy "./nginx-letsencrypt…" 22 minutes ago Up 22 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nginxproxy