Docker Compose
First, prepare the Compose file.
docker-compose.yml
version: '3'
services:
react:
build: ./docker/react
volumes:
- ./react:/usr/src/app
ports:
- "3000:3000"
tty: true
Dockerfile
Next, prepare the Dockerfile.
Place it in ./docker/react
described in the Compose file.
The file name is Dockerfile
.
FROM node:15.3.0-alpine3.10
WORKDIR /usr/src/app
EXPOSE 3000
Execute the following command.
$ docker-compose up -d
$ docker-compose exec react npx create-react-app .
$ docker-compose exec react npm start
http://localhost:3000 If you access and the screen is displayed, it is successful.
Recommended Posts