0
votes

Create the scratch react application using "create-react-app docker-build" then try to build the docker image for it with below docker script but it throws error when try to run that docker image.

Docker version have used: Docker version 18.09.0, build 4d60db4

Simply follow the steps in below post for docker exploration with react app but i end up with error like below

Reference : https://medium.com/@shakyShane/lets-talk-about-docker-artifacts-27454560384f

Step 1: Build the docker image success.

docker build -t testwebapp .

Step 2: Run the that image with below command

docker run -p 8080:80 testwebapp:latest

Docker script used:

FROM node:10.9 as build-deps
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
FROM nginx:1.12-alpine
COPY - from=build-deps /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Error log:

docker: Error response from daemon: driver failed programming external connectivity on endpoint festive_margulis (71686edb7753ec2fdf019ef4cfcf0e95476e1fb7c2368084feb17fd2551fcf45): Error starting userland proxy: mkdir /port/tcp:0.0.0.0:8080:tcp:172.17.0.3:80: input/output error.

2

2 Answers

1
votes

Usually, this is a problem with the Docker engine.

service docker restart
0
votes

If you are working with Windows you have to specify the ip address like

docker run -ip 127.0.0.1 -p 8080:80 testwebapp:latest

And usually for me i have to restart the docker on windows after pc start twice then works everything as it should