skip to Main Content

I am trying to build a (node.js + python) image.
This is the dockerfile i used:

FROM ubuntu
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common

#install freecad
RUN add-apt-repository ppa:freecad-maintainers/freecad-daily
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y freecad-daily

#install utils
RUN DEBIAN_FRONTEND=noninteractive apt install -y git


#install node
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git-core curl build-essential openssl libssl-dev 
 && git clone https://github.com/nodejs/node.git 
 && cd node 
 && ./configure 
 && make 
 && sudo make install
 
COPY . . 
 
RUN npm install

CMD ["node","server.js"]

Then i build the image with sudo docker build -t node_freecad .

However, the image building process gets stuck at some point.
The last line that is stuck – it says Cloning into 'node'...

I am including all the messages of the docker build commmand:

Sending build context to Docker daemon  111.5MB
Step 1/10 : FROM ubuntu
 ---> d70eaf7277ea
Step 2/10 : RUN DEBIAN_FRONTEND=noninteractive apt-get update
 ---> Using cache
 ---> 7dc6a01d1d6c
Step 3/10 : RUN DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
 ---> Using cache
 ---> 07840a864e09
Step 4/10 : RUN add-apt-repository ppa:freecad-maintainers/freecad-daily
 ---> Using cache
 ---> 75dda85d9d9f
Step 5/10 : RUN DEBIAN_FRONTEND=noninteractive apt-get update
 ---> Using cache
 ---> 9608ae09d24a
Step 6/10 : RUN DEBIAN_FRONTEND=noninteractive apt-get install -y freecad-daily
 ---> Using cache
 ---> 41dc911c0e05
Step 7/10 : RUN DEBIAN_FRONTEND=noninteractive apt install -y git
 ---> Using cache
 ---> 249124be8b81
Step 8/10 : RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git-core curl build-essential openssl libssl-dev  && git clone https://github.com/nodejs/node.git  && cd node  && ./configure  && make  && sudo make install
 ---> Running in e89538d16c8d
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.25.1-1ubuntu3).
openssl is already the newest version (1.1.1f-1ubuntu2).
openssl set to manually installed.
The following additional packages will be installed:
  dpkg-dev fakeroot g++ g++-9 libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libcurl4 libdpkg-perl libfakeroot
  libfile-fcntllock-perl libstdc++-9-dev make
Suggested packages:
  debian-keyring g++-multilib g++-9-multilib gcc-9-doc bzr libssl-doc
  libstdc++-9-doc make-doc
The following NEW packages will be installed:
  build-essential curl dpkg-dev fakeroot g++ g++-9 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libcurl4 libdpkg-perl
  libfakeroot libfile-fcntllock-perl libssl-dev libstdc++-9-dev make
0 upgraded, 16 newly installed, 0 to remove and 1 not upgraded.
Need to get 13.4 MB of archives.
After this operation, 61.3 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libstdc++-9-dev amd64 9.3.0-17ubuntu1~20.04 [1714 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.3.0-17ubuntu1~20.04 [8405 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1ubuntu2 [1604 B]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 make amd64 4.2.1-1.2 [162 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 libdpkg-perl all 1.19.7ubuntu3 [230 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 dpkg-dev all 1.19.7ubuntu3 [679 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 build-essential amd64 12.8ubuntu1.1 [4664 B]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libcurl4 amd64 7.68.0-1ubuntu2.2 [233 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 curl amd64 7.68.0-1ubuntu2.2 [161 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 libfakeroot amd64 1.24-1 [25.7 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 fakeroot amd64 1.24-1 [62.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 libalgorithm-diff-perl all 1.19.03-2 [46.6 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 libalgorithm-diff-xs-perl amd64 0.04-6 [11.3 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/main amd64 libfile-fcntllock-perl amd64 0.22-3build4 [33.1 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 libssl-dev amd64 1.1.1f-1ubuntu2 [1582 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 13.4 MB in 50s (269 kB/s)
Selecting previously unselected package libstdc++-9-dev:amd64.
(Reading database ... 57086 files and directories currently installed.)
Preparing to unpack .../00-libstdc++-9-dev_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking libstdc++-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package g++-9.
Preparing to unpack .../01-g++-9_9.3.0-17ubuntu1~20.04_amd64.deb ...
Unpacking g++-9 (9.3.0-17ubuntu1~20.04) ...
Selecting previously unselected package g++.
Preparing to unpack .../02-g++_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking g++ (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package make.
Preparing to unpack .../03-make_4.2.1-1.2_amd64.deb ...
Unpacking make (4.2.1-1.2) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../04-libdpkg-perl_1.19.7ubuntu3_all.deb ...
Unpacking libdpkg-perl (1.19.7ubuntu3) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../05-dpkg-dev_1.19.7ubuntu3_all.deb ...
Unpacking dpkg-dev (1.19.7ubuntu3) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../06-build-essential_12.8ubuntu1.1_amd64.deb ...
Unpacking build-essential (12.8ubuntu1.1) ...
Selecting previously unselected package libcurl4:amd64.
Preparing to unpack .../07-libcurl4_7.68.0-1ubuntu2.2_amd64.deb ...
Unpacking libcurl4:amd64 (7.68.0-1ubuntu2.2) ...
Selecting previously unselected package curl.
Preparing to unpack .../08-curl_7.68.0-1ubuntu2.2_amd64.deb ...
Unpacking curl (7.68.0-1ubuntu2.2) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../09-libfakeroot_1.24-1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.24-1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../10-fakeroot_1.24-1_amd64.deb ...
Unpacking fakeroot (1.24-1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../11-libalgorithm-diff-perl_1.19.03-2_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.03-2) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../12-libalgorithm-diff-xs-perl_0.04-6_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-6) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../13-libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../14-libfile-fcntllock-perl_0.22-3build4_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3build4) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../15-libssl-dev_1.1.1f-1ubuntu2_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1f-1ubuntu2) ...
Setting up libstdc++-9-dev:amd64 (9.3.0-17ubuntu1~20.04) ...
Setting up libfile-fcntllock-perl (0.22-3build4) ...
Setting up libalgorithm-diff-perl (1.19.03-2) ...
Setting up libfakeroot:amd64 (1.24-1) ...
Setting up fakeroot (1.24-1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/fakeroot.1.gz because associated file /usr/share/man/man1/fakeroot-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/faked.1.gz because associated file /usr/share/man/man1/faked-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/es/man1/fakeroot.1.gz because associated file /usr/share/man/es/man1/fakeroot-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/es/man1/faked.1.gz because associated file /usr/share/man/es/man1/faked-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/fr/man1/fakeroot.1.gz because associated file /usr/share/man/fr/man1/fakeroot-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/fr/man1/faked.1.gz because associated file /usr/share/man/fr/man1/faked-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/sv/man1/fakeroot.1.gz because associated file /usr/share/man/sv/man1/fakeroot-sysv.1.gz (of link group fakeroot) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/sv/man1/faked.1.gz because associated file /usr/share/man/sv/man1/faked-sysv.1.gz (of link group fakeroot) doesn't exist
Setting up make (4.2.1-1.2) ...
Setting up libssl-dev:amd64 (1.1.1f-1ubuntu2) ...
Setting up g++-9 (9.3.0-17ubuntu1~20.04) ...
Setting up libdpkg-perl (1.19.7ubuntu3) ...
Setting up g++ (4:9.3.0-1ubuntu2) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/c++.1.gz because associated file /usr/share/man/man1/g++.1.gz (of link group c++) doesn't exist
Setting up libcurl4:amd64 (7.68.0-1ubuntu2.2) ...
Setting up curl (7.68.0-1ubuntu2.2) ...
Setting up libalgorithm-diff-xs-perl (0.04-6) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up dpkg-dev (1.19.7ubuntu3) ...
Setting up build-essential (12.8ubuntu1.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Cloning into 'node'...

UPDATE:
After a lot of time, the console proceeds, but this is what happens next:

Updating files: 100% (32211/32211), done.
Traceback (most recent call last):
  File "./configure", line 21, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils.spawn'
The command '/bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y git-core curl build-essential openssl libssl-dev  && git clone https://github.com/nodejs/node.git  && cd node  && ./configure  && make  && sudo make install' returned a non-zero code: 1

EDIT 2:
This is the dockerfile that SiHa suggested, and the error i got

FROM ubuntu
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common

#install freecad
RUN add-apt-repository ppa:freecad-maintainers/freecad-daily
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y freecad-daily

#install utils
RUN DEBIAN_FRONTEND=noninteractive apt install -y git

RUN apt install -y python3-distutils

#install node
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git-core curl build-essential openssl libssl-dev 
 && git clone https://github.com/nodejs/node.git 
 && cd node 
 && ./configure 
 && make 
 && sudo make install


COPY . . 
 
RUN npm install

CMD ["node","server.js"]

And the error…

  touch /node/out/Release/obj.target/node_etw.stamp
  touch /node/out/Release/obj.target/specialize_node_d.stamp
  touch /node/out/Release/obj.host/tools/icu/icui18n.stamp
  touch /node/out/Release/obj.host/tools/icu/icuuc.stamp
  touch /node/out/Release/obj.host/tools/v8_gypfiles/v8_cppgc_shared.stamp
rm f3f5b560e1d922d1c82a58e0b85ee72dc68149b7.intermediate 5e7e6dacce553103c642464481a37d2a5cf36482.intermediate 889aa6e08bf291915b2edfb5755eacba271e7d14.intermediate e386eeb6ace903d2f67ebd2ef32f711b9a84c10d.intermediate
if [ ! -r node -o ! -L node ]; then 
  ln -fs out/Release/node node; fi
/bin/sh: 1: sudo: not found
The command '/bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y git-core curl build-essential openssl libssl-dev  && git clone https://github.com/nodejs/node.git  && cd node  && ./configure  && make  && sudo make install' returned a non-zero code: 127

2

Answers


  1. How about using node.js docker official image
    https://hub.docker.com/_/node

    You can change the nodejs version(14.15.1) you want

    FROM node:14.15.1
    RUN apt-get update || : && apt-get install python -y
    
    WORKDIR /app
    COPY . /app
    
    RUN npm install
    CMD ["node","server.js"]
    
    Login or Signup to reply.
  2. Your error is clearly saying that you are missing distutils.spawn and this thread on the nodejs issue tracker says that installing python3-distutils will provide this package.

    So I would try, at an earlier stage in the Dockerfile: apt install -y python3-distutils

    Also, I would suggest that chaining all the apt command together with the git clone etc is bad practice. It certainly makes it hard to debug.

    If you want to reduce layers, I would chain all these together:

    RUN add-apt-repository ppa:freecad-maintainers/freecad-daily
    RUN DEBIAN_FRONTEND=noninteractive apt-get update
    RUN DEBIAN_FRONTEND=noninteractive apt-get install -y freecad-daily
    
    #install utils
    RUN DEBIAN_FRONTEND=noninteractive apt install -y git
    
    
    #install node
    RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git-core curl build-essential openssl libssl-dev
    

    Then have this:

    git clone https://github.com/nodejs/node.git 
     && cd node 
     && ./configure 
     && make 
     && sudo make install
    

    as a separate RUN stage

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search