[JAVA] Run React on a Docker container

Confirmation environment

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

Command execution

Execute the following command.

Container startup

$ docker-compose up -d

React application creation

$ docker-compose exec react npx create-react-app .

Server startup

$ docker-compose exec react npm start

Operation check

http://localhost:3000 If you access and the screen is displayed, it is successful.

Recommended Posts

Run React on a Docker container
Run PureScript on a Docker container
Run GUI application on Docker container
Run NordVPN on Docker (Windows) Ubuntu container
Run phpunit on Docker
Run GUI application on Docker container (Japanese input)
I made a Docker container to run Maven
I tried running Ansible on a Docker container
Run VS Code on Docker
Run openvpn on Docker (windows)
Run the Android emulator on Docker using Android Emulator Container Scripts
Run SSE (Server-Sent-Event) samples on docker
Steps to run docker on Mac
Run puppeteer-core on Heroku (Docker edition)
Run the AWS CLI on Docker
How to run JavaFX on Docker
I tried running a Docker container on AWS IoT Greengrass 2.0
Try Hello World using plain Java on a Docker container
[Microsoft] Run Azure Pipelines (VSTS) Agent on Docker or Azure Container Instance
I tried deploying a Docker container on Lambda with Serverless Framework
Run (provisionally) a Docker image with ShellCommandActivity on AWS Data Pipeline
Launch docker container on EC2 (personal memorandum)
Run Embulk on Docker to convert files
Try building a GPU container on GCP.
Until you run apache on ubuntu on docker
Run Ubuntu + ROS with Docker on Mac
Liberty on Docker
Access MySQL on a Docker container from a local (host OS) Java program
Starting with installing Docker on EC2 and running Yellowfin in a container
Run x11 apps in a Docker container (supports network access from the container)
Small Docker container
Created a Docker container image for an OpenLDAP server based on Fedora
Redmine on Docker
How to deploy a container on AWS Lambda
Create a Lambda Container Image based on Java 15
Build a Kotlin app using OpenJDK's Docker container
Run JSP Hello World with Tomcat on Docker
Send emails using Docker container on Raspberry Pi 3
Build a container for Docker x Laravel phpMyAdmin
Update container image with KUSANAGI Runs on Docker
Docker Container pull has a rate limit enforced
Run autossh as a systemd service on CentOS
Create a Docker container for your development web server in Ansible on MacOS
Build a development environment to create Ruby on Jets + React apps with Docker
Run STS4 on Mac
Build a docker container for a python simple web server
Systemctl cannot be used on Ubuntu inside Docker container
Create a Java (Gradle) project with VS Code and develop it on a Docker container
Docker installation on CentOS 6
Lambda on Terraform Container
python notes on docker
Run Pico with docker
Run PostgreSQL on Java
Install Docker on Manjaro
Let's create a gcloud development environment on a centos8 container
Create a Docker container to convert EPS to PGF source
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
GitHub Actions/Cache: Cache bundle installed gems on Docker container
Run Payara with Docker
[Docker] Build an Apache container on EC2 using dockerfile
A memorandum when installing Docker and building a Linux container