I'm trying to run a react app from a docker container (currently developing locally.) I get this error
Attaching to my-app_c
my-app_c  | 
my-app_c  | > my-app@0.1.0 start
my-app_c  | > sudo PORT=80 react-scripts start
my-app_c  | 
my-app_c  | sh: sudo: not found
my-app_c exited with code 127
I do have access to sudo. This q/a recommended running docker exec -u root -t -i container_id /bin/bash but this triggered another error: Error response from daemon: Container bad3f69996f3814078d1ed94d3d261e3ffea2ab6a95f7151f576115fa6854f72 is not running.
So it seems that I cannot give a docker container root permissions until it is already running and it cannot run until it has sudo access. How to I solve this chicken or the egg type problem?
Edit:
Showing Docker File and YAML file
Dockerfile
FROM node:17-alpine 
WORKDIR /my-app
COPY package.json . 
RUN npm install 
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
docker-compose.yaml
version: "3.8"
services:
  my-app: 
    build: ./my-app
    container_name: my-app_c
    ports:
      - '3000:3000'
    stdin_open: true
    tty: true   
 
    