Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build is failing on npm install --production command #27

Open
ranarauf68 opened this issue Dec 31, 2019 · 8 comments
Open

Docker build is failing on npm install --production command #27

ranarauf68 opened this issue Dec 31, 2019 · 8 comments

Comments

@ranarauf68
Copy link

ranarauf68 commented Dec 31, 2019

Deploy script is failing where it tries to build a docker image at this line.

docker build -t "cloudformation-lambda-$function" .

The error is:
The command '/bin/sh -c npm install --production' returned a non-zero code: 132.

In Dockerfile, this is the particular line which is failing:

RUN npm install --production

I tried googling it but none of the proposed solutions is working. Please help.

@jpsim
Copy link
Owner

jpsim commented Dec 31, 2019

Can you try changing that npm install line to this to see if you get more details about the error?

RUN npm install --production --loglevel verbose

@ranarauf68
Copy link
Author

Thanks for the quick response. Since this is happening on docker container, I tried running the container in the interactive mode and run the command npm install --production --loglevel verbose. Got the following error:

Illegal instruction (core dumped)

Before doing above, I modified the docker file as you suggested and run the build command. Here is the entry from /var/log/syslog file:

Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024952.718497] docker0: port 2(vethd1855f6) entered blocking state
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024952.718499] docker0: port 2(vethd1855f6) entered disabled state
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024952.718547] device vethd1855f6 entered promiscuous mode
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024952.718642] IPv6: ADDRCONF(NETDEV_UP): vethd1855f6: link is not ready
Dec 31 16:19:21 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-resolved[15285]: message repeated 5 times: [ Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.]
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[8935]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[8935]: Could not generate persistent MAC address for vethb29fb6f: No such file or directory
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[8940]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[8940]: Could not generate persistent MAC address for vethd1855f6: No such file or directory
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.0261] manager: (vethb29fb6f): new Veth device (/org/freedesktop/NetworkManager/Devices/357)
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.0273] manager: (vethd1855f6): new Veth device (/org/freedesktop/NetworkManager/Devices/358)
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.0702] devices added (path: /sys/devices/virtual/net/vethb29fb6f, iface: vethb29fb6f)
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.0702] device added (path: /sys/devices/virtual/net/vethb29fb6f, iface: vethb29fb6f): no ifupdown configuration found.
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.0788] devices added (path: /sys/devices/virtual/net/vethd1855f6, iface: vethd1855f6)
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.0788] device added (path: /sys/devices/virtual/net/vethd1855f6, iface: vethd1855f6): no ifupdown configuration found.
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC containerd[942]: time="2019-12-31T16:21:00.533461197-06:00" level=info msg="shim containerd-shim started" address="/containerd-shim/moby/e08908194abb9fb31fdc7907f7f340866a294e8722bc1833f28f2ce7b947ad9d/shim.sock" debug=false pid=9005
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024953.578821] eth0: renamed from vethb29fb6f
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024953.594550] IPv6: ADDRCONF(NETDEV_CHANGE): vethd1855f6: link becomes ready
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024953.594616] docker0: port 2(vethd1855f6) entered blocking state
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024953.594617] docker0: port 2(vethd1855f6) entered forwarding state
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.8909] devices removed (path: /sys/devices/virtual/net/vethb29fb6f, iface: vethb29fb6f)
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830860.8920] device (vethd1855f6): carrier: link connected
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[3434]: Removing a network device that was not added
Dec 31 16:21:00 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[1600]: Removing a network device that was not added
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024954.092136] traps: node[9045] trap invalid opcode ip:7fd0c6fdcb30 sp:7ffef6e0d358 error:0 in libstdc++.so.6.0.20[7fd0c6f7d000+11e000]
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC containerd[942]: time="2019-12-31T16:21:01.713681861-06:00" level=info msg="shim reaped" id=e08908194abb9fb31fdc7907f7f340866a294e8722bc1833f28f2ce7b947ad9d
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC dockerd[32725]: time="2019-12-31T16:21:01.723683660-06:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024954.495272] docker0: port 2(vethd1855f6) entered disabled state
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024954.497380] vethb29fb6f: renamed from eth0
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[9192]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830861.8357] manager: (vethb29fb6f): new Veth device (/org/freedesktop/NetworkManager/Devices/359)
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830861.8651] devices added (path: /sys/devices/virtual/net/vethb29fb6f, iface: vethb29fb6f)
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830861.8651] device added (path: /sys/devices/virtual/net/vethb29fb6f, iface: vethb29fb6f): no ifupdown configuration found.
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024954.628262] docker0: port 2(vethd1855f6) entered disabled state
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024954.635323] device vethd1855f6 left promiscuous mode
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024954.635330] docker0: port 2(vethd1855f6) entered disabled state
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830861.9469] devices removed (path: /sys/devices/virtual/net/vethb29fb6f, iface: vethb29fb6f)
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830861.9530] device (vethd1855f6): released from master device docker0
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[1600]: Removing a network device that was not added
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[1600]: Removing a network device that was not added
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[3434]: Removing a network device that was not added
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[3434]: Removing a network device that was not added
Dec 31 16:21:01 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830861.9739] devices removed (path: /sys/devices/virtual/net/vethd1855f6, iface: vethd1855f6)
Dec 31 16:21:02 faisal-HP-Compaq-6005-Pro-SFF-PC dockerd[32725]: time="2019-12-31T16:21:02.122304464-06:00" level=warning msg="e08908194abb9fb31fdc7907f7f340866a294e8722bc1833f28f2ce7b947ad9d cleanup: failed to unmount IPC: umount /var/lib/docker/containers/e08908194abb9fb31fdc7907f7f340866a294e8722bc1833f28f2ce7b947ad9d/mounts/shm, flags: 0x2: no such file or directory"
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[9735]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[9735]: Could not generate persistent MAC address for vethc4f1918: No such file or directory
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.1851] manager: (vethc4f1918): new Veth device (/org/freedesktop/NetworkManager/Devices/360)
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[9736]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[9736]: Could not generate persistent MAC address for veth4e78759: No such file or directory
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.1886] manager: (veth4e78759): new Veth device (/org/freedesktop/NetworkManager/Devices/361)
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024987.896864] docker0: port 2(veth4e78759) entered blocking state
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024987.896867] docker0: port 2(veth4e78759) entered disabled state
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024987.897199] device veth4e78759 entered promiscuous mode
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024987.899853] IPv6: ADDRCONF(NETDEV_UP): veth4e78759: link is not ready
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.2205] devices added (path: /sys/devices/virtual/net/vethc4f1918, iface: vethc4f1918)
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.2205] device added (path: /sys/devices/virtual/net/vethc4f1918, iface: vethc4f1918): no ifupdown configuration found.
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.2322] devices added (path: /sys/devices/virtual/net/veth4e78759, iface: veth4e78759)
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.2322] device added (path: /sys/devices/virtual/net/veth4e78759, iface: veth4e78759): no ifupdown configuration found.
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC containerd[942]: time="2019-12-31T16:21:35.711892623-06:00" level=info msg="shim containerd-shim started" address="/containerd-shim/moby/02785ec5f6be9261ba3d4576630262fb47f16e2696d24f3e625fea910af4fd2d/shim.sock" debug=false pid=9770
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024988.671905] eth0: renamed from vethc4f1918
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[3434]: Removing a network device that was not added
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024988.691135] IPv6: ADDRCONF(NETDEV_CHANGE): veth4e78759: link becomes ready
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024988.691237] docker0: port 2(veth4e78759) entered blocking state
Dec 31 16:21:35 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024988.691238] docker0: port 2(veth4e78759) entered forwarding state
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[1600]: Removing a network device that was not added
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.9826] devices removed (path: /sys/devices/virtual/net/vethc4f1918, iface: vethc4f1918)
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830895.9877] device (veth4e78759): carrier: link connected
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024989.250920] traps: node[9800] trap invalid opcode ip:7f9df7a29b30 sp:7ffd877f20a8 error:0 in libstdc++.so.6.0.20[7f9df79ca000+11e000]
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC containerd[942]: time="2019-12-31T16:21:36.863163653-06:00" level=info msg="shim reaped" id=02785ec5f6be9261ba3d4576630262fb47f16e2696d24f3e625fea910af4fd2d
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC dockerd[32725]: time="2019-12-31T16:21:36.873382068-06:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024989.632940] docker0: port 2(veth4e78759) entered disabled state
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024989.634198] vethc4f1918: renamed from eth0
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC systemd-udevd[9882]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830896.9654] manager: (vethc4f1918): new Veth device (/org/freedesktop/NetworkManager/Devices/362)
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830896.9941] devices added (path: /sys/devices/virtual/net/vethc4f1918, iface: vethc4f1918)
Dec 31 16:21:36 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830896.9941] device added (path: /sys/devices/virtual/net/vethc4f1918, iface: vethc4f1918): no ifupdown configuration found.
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024989.766059] docker0: port 2(veth4e78759) entered disabled state
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024989.777539] device veth4e78759 left promiscuous mode
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC kernel: [1024989.777548] docker0: port 2(veth4e78759) entered disabled state
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830897.0869] devices removed (path: /sys/devices/virtual/net/vethc4f1918, iface: vethc4f1918)
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830897.0908] device (veth4e78759): released from master device docker0
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[3434]: Removing a network device that was not added
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[3434]: Removing a network device that was not added
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[1600]: Removing a network device that was not added
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC gnome-shell[1600]: Removing a network device that was not added
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC NetworkManager[664]: [1577830897.1220] devices removed (path: /sys/devices/virtual/net/veth4e78759, iface: veth4e78759)
Dec 31 16:21:37 faisal-HP-Compaq-6005-Pro-SFF-PC dockerd[32725]: time="2019-12-31T16:21:37.281064125-06:00" level=warning msg="02785ec5f6be9261ba3d4576630262fb47f16e2696d24f3e625fea910af4fd2d cleanup: failed to unmount IPC: umount /var/lib/docker/containers/02785ec5f6be9261ba3d4576630262fb47f16e2696d24f3e625fea910af4fd2d/mounts/shm, flags: 0x2: no such file or directory"

@jpsim
Copy link
Owner

jpsim commented Dec 31, 2019

I don't have good advice for debugging further. Since this error appears to be related to npm install, I'd suggest asking for help in the npm forums: https://npm.community/c/support

@ranarauf68
Copy link
Author

OK. Thanks.

@ranarauf68
Copy link
Author

I'm able to resolve it. But I had to create 3 entirely new Dockerfiles. I am using amazonlinux instead of lambci. Please let me know if you want me to check those Dockerfiles into your repository.

@jpsim
Copy link
Owner

jpsim commented Jan 4, 2020

Would you mind filing a PR? I may not merge it but it might be helpful if anyone else runs into this. Thanks!

@ranarauf68
Copy link
Author

ranarauf68 commented Jan 9, 2020

It has been a while since I worked on Git and forgot the commands. Here is one of the Dockerfiles (site-builder). Should be good enough for people to create others if needed.

FROM amazonlinux

RUN yum install -y tar
RUN yum install -y gzip
RUN yum install -y zip

RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
RUN /bin/bash -c "source /root/.nvm/nvm.sh; nvm install 6.11.5"

CMD /bin/bash -c "source /root/.nvm/nvm.sh; nvm use 6.11.5"
RUN /bin/bash -c "source /root/.nvm/nvm.sh; npm install --production"

RUN mkdir /build
RUN mkdir /data
WORKDIR /build

COPY package.json /build/package.json

RUN /bin/bash -c "source /root/.nvm/nvm.sh; npm install --production"

COPY index.js /build/index.js

COPY homepage /build/homepage
COPY album /build/album

RUN zip -r /build/dist.zip . > /dev/null
CMD ["cat", "/build/dist.zip"]

@jpsim
Copy link
Owner

jpsim commented Jan 9, 2020

Thanks for posting! Let’s keep this issue open to make it easier for others to find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants