Мой docker-compose.yml
version: "3.8"
services:
yarn:
image: node:14-alpine
container_name: jtt-yarn
restart: unless-stopped
command: sh -c "yarn install && yarn run prod"
ports:
- 3000:3000
working_dir: /var/www/
volumes:
- ./:/var/www/
networks:
- jtt
db:
image: mysql:5.7
container_name: jtt-db
restart: unless-stopped
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- ./docker-compose/mysql:/docker-entrypoint-initdb.d
networks:
- jtt
nginx:
image: nginx:alpine
container_name: jtt-nginx
restart: unless-stopped
ports:
- ${DOCKER_NGINX_PORT}:80
volumes:
- ./:/var/www
- ./docker-compose/nginx:/etc/nginx/conf.d/
networks:
- jtt
networks:
jtt:
driver: bridge
Но такой код
docker-compose exec app node --version
в контейнере не работает.
как в контейнере запустить какой либо скрипт
node app.js