I have been working on my local machine with no issue using the Dokerfile below and docker-compose.ylm
Dokerfile
FROM node:14-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5000
CMD [ "npm", "start" ]
compose file
...
app:
build:
context: .
dockerfile: Dockerfile
container_name: app
restart: always
image: nodeapp
ports:
- 5000:5000
volumes:
- ./:/app
- /app/node_modules
networks:
- pnet
...
When I use docker context to switch to remote host
docker context create --docker "host=ssh://root@hostname" remote
and
docker context use remote
and run docker compose up I end up with the error
npm ERR! code ENOENT api | npm ERR! syscall open api | npm ERR! path /app/package.json paylign_api | npm ERR! errno -2 api | npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json' api | npm ERR! enoent This is related to npm not being able to find a file. api | npm ERR! enoent api | api | npm ERR! A complete log of this run can be found in: api | npm ERR! /root/.npm/_logs/2022-07-01T14_33_58_429Z-debug.log
How can I fix this so as to deploy to remote host