Search code examples
dockerdockerfileethereumpm2ubuntu-20.04

/root/start.sh: line 5: /usr/bin/pm2: No such file or directory - Docker Container is restarting


I'm trying to run on my Ubuntu 20.04 machine a cluster of docker containers present in this repository :

https://github.com/Capgemini-AIE/ethereum-docker

My dockerfile:

FROM ethereum/client-go

RUN apk update && apk add bash
RUN apk add --update git bash nodejs npm perl

RUN cd /root &&\
git clone https://github.com/cubedro/eth-net-intelligence-api &&\
cd eth-net-intelligence-api &&\
npm install &&\
npm install -g pm2

ADD start.sh /root/start.sh
ADD app.json /root/eth-net-intelligence-api/app.json
RUN chmod +x /root/start.sh

ENTRYPOINT /root/start.sh

The commands:

sudo docker-compose build
sudo docker-compose up -d

are done correctly, but when execute:

docker exec -it ethereum-docker-master_eth_1 geth attach ipc://root/.ethereum/devchain/geth.ipc

i have this error:

ERROR: Container 517e11aef83f0da580fdb91b6efd19adc8b1f489d6a917b43cc2d22881b865c6 is restarting, wait until the container is running

The reason is, executing:

docker logs ethereum-docker-master_eth_1

result:\

/root/start.sh: line 5: /usr/bin/pm2: No such file or directory\
/root/start.sh: line 5: /usr/bin/pm2: No such file or directory\
/root/start.sh: line 5: /usr/bin/pm2: No such file or directory

Why do I have this problem? In the Docker file I have the command:

RUN npm install -g pm2

How can I solve the problem?


Solution

  • When I build an image with this dockerfile and then check the files in it I find that pm2 is installed at /usr/local/bin/pm2:

    image layer info

    So you need to change the call in your script to

    /usr/local/bin/pm2