admin管理员组

文章数量:1296400

To reproduce:

$npx create-expo-app@latest expo-hello-world

$cd expo-hello-world/

$npx expo start

This pulls up a sample application, logging the QR code that can be scanned to access it. All is well. Now the problem is when I try to docker-ize the same process. I added the following to the created project:

Dockerfile

FROM node:23-alpine AS builder
WORKDIR /app
COPY package.json ./
RUN yarn install
COPY . .
RUN npx expo install
FROM node:23-alpine AS server
WORKDIR /app
COPY --from=builder /app/ ./
EXPOSE 8081
CMD ["npx", "expo", "start", "-c", "--go"]

docker-compose.yml

services:
  app-expo:
    build:
      context: ./
      dockerfile: Dockerfile
    ports:
      - "8081:8081"
    environment:
      - EXPO_PUBLIC_APP_BASE_URL=http://192.186.86.197:8081
    networks:
      - 'app-network'
networks:
  app-network:

.dockerignore

node_modules/
.expo/

No QR code is present when I try through Docker doing docker compose up. Has anyone had any luck doing this? Thanks in advance.

I tried to run the same process in Docker as on the command line and Docker did not produce a QR code to open the application.

本文标签: React Native Expo Doesn39t Show QR Code When Run in DockerStack Overflow