简体   繁体   中英

Docker cloud services stop with script not found

I've been trying to deploy my app with docker cloud stack. I've tested this locally and I've also tested with docker-compose and they worked successfully.

However, when I tried to deploy my docker container from my registry which is in my docker repo with docker cloud stack, it always stops with below code.

[app-1]2018-02-10T06:09:03.316866500Z script not found : /src/dist/index.js

[app-1]2018-02-10T06:09:03.317330400Z Exiting PM2

[app-1]2018-02-10T06:09:03.442521200Z 0 application online, exiting

[app-1]2018-02-10T06:09:03.442686000Z Exiting PM2

I've tried to set src/dist/index.js to dist/index.js and tried many other things and none of them worked for me.

My Dockerfile looks like below.

FROM dooboolab/ubuntu-nodejs-ffmpeg-sharp:latest

WORKDIR /src
COPY package*.json ./

# RUN npm install
RUN npm install --only=production

# If you are building your code for production

# Bundle app source
ADD . /src

EXPOSE 3000
CMD ["pm2-docker", "/dist/index.js"]

And my stack file is simple like below. app: environment: - NODE_ENV=production image: 'my_private_image:latest' ports: - '3000:3000'

Again, my_private_image:latest works just fine when I build my container from docker repo in my local machine.

What else can I try more to solve this issue?

I've found out solution. This was because locally, it was referencing relative path. However, when ran from docker stack, it is running from absolute path so the path was different.

To successfully build from docker-stack, I had to set the absolute path in the image and build it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM