PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 18, 2022

[FIXED] How to launch Dockerized app onto another computer

 October 18, 2022     docker, react-native     No comments   

Issue

I'm quite new to Docker and this question might seem trivial but there it is.

So I've dockerized a brand new React Native app (As a proof of concept) on my Computer A, and the container works fine but after taking out the container onto my Computer B (I transform it into a .tar.gz file then load and run the image) I have this error : Error no such file or directory

It works on Computer A with the react project being in the same folder as the Dockerfile, but when I launch the container on Computer B it tells me that it can't find the app folder even when imported on the computer

Feel free to ask any question since I know my explanations can be troubled.

Edit to Answer larsks :

A : I get my .tar.gz file with docker save app | gzip -> testApp.tar.gz

B :I then transfer my container with scp testApp.tar.gz second@computer

C : I run the image with docker load < testApp.tar.gz then docker run app

D : The exact output is

npm ERR! syscall open
npm ERR! path /app/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

Edit2 :

Dockerfile :

FROM arm64v8/node:14
COPY qemu-aarch64-static /usr/bin

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /app

CMD ["npm", "start"]

docker-compose.yml

version: "3.3"

services:
  app:
    image: app:latest
    build: .
    ports:
      - 19000:19000
      - 19001:19001
      - 19002:19002
      - 19006:19006
    environment:
      - NODE_ENV=dev
      - EXPO_DEVTOOLS_LISTEN_ADDRESS=0.0.0.0
      - REACT_NATIVE_PACKAGER_HOSTNAME=0.0.0.0
    volumes:
      - ./app:/app/

The app is simply the app from the base project of React native npx create-expo-app app


Solution

The problem was that I didn't use ADD in my dockerfile so the container didn't included my app file.

Add this to Dockerfile :

ADD /app ./


Answered By - Aleks
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing