MISP / x_old_misp_docker

MISP Docker (XME edition)
283 stars 167 forks source link

docker-compose build fails on M1 Mac #141

Closed fukusuket closed 2 years ago

fukusuket commented 2 years ago

Context

Expected Behavior

docker-compose build succeeded.

Current Behavior

docker-compose build failed.

Steps to Reproduce

  1. git clone https://github.com/MISP/misp-docker
  2. cd misp-docker
  3. cp template.env .env
  4. docker-compose build

Failure Logs

> docker-compose build
db uses an image, skipping
Building web
[+] Building 83.5s (15/23)                                                                                                                                    
 => [internal] load build definition from Dockerfile                                                                                                     0.0s
 => => transferring dockerfile: 2.59kB                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/ubuntu:latest                                                                                         3.4s
 => [internal] load build context                                                                                                                        0.0s
 => => transferring context: 136.38kB                                                                                                                    0.0s
 => [ 1/19] FROM docker.io/library/ubuntu:latest@sha256:b5a61709a9a44284d88fb12e5c48db0409cfad5b69d4ff8224077c57302df9cf                                 1.4s
 => => resolve docker.io/library/ubuntu:latest@sha256:b5a61709a9a44284d88fb12e5c48db0409cfad5b69d4ff8224077c57302df9cf                                   0.0s
 => => sha256:64162ac111b666daf1305de1888eb67a3033f62000f5ff781fe529aff8f88b09 529B / 529B                                                               0.0s
 => => sha256:9f4877540c734dfd8ee2e523b1487788f871e64a4f3137797d33e5971ac9adde 1.48kB / 1.48kB                                                           0.0s
 => => sha256:5f3d23ccb99f6c9462a15efcf35aef0863858073a06d56df671d0e791b26222a 27.17MB / 27.17MB                                                         0.7s
 => => sha256:b5a61709a9a44284d88fb12e5c48db0409cfad5b69d4ff8224077c57302df9cf 1.42kB / 1.42kB                                                           0.0s
 => => extracting sha256:5f3d23ccb99f6c9462a15efcf35aef0863858073a06d56df671d0e791b26222a                                                                0.7s
 => [ 2/19] RUN apt-get update &&     apt-get dist-upgrade -y && apt-get upgrade && apt-get autoremove -y && apt-get clean &&     apt-get install -y s  53.1s
 => [ 3/19] RUN add-apt-repository ppa:deadsnakes/ppa                                                                                                    7.8s
 => [ 4/19] RUN apt-get update && apt-get -y install python3.9 python3-pip                                                                              13.6s 
 => [ 5/19] RUN pip3 install --upgrade pip                                                                                                               2.4s 
 => [ 6/19] RUN locale-gen en_US.UTF-8                                                                                                                   1.0s 
 => [ 7/19] RUN useradd misp && usermod -aG sudo misp                                                                                                    0.3s 
 => [ 8/19] COPY --chown=misp:misp INSTALL_NODB.sh* ./                                                                                                   0.0s 
 => [ 9/19] RUN chmod +x INSTALL_NODB.sh                                                                                                                 0.1s 
 => [10/19] RUN echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers                                                                                       0.1s 
 => ERROR [11/19] RUN bash INSTALL_NODB.sh -A -u                                                                                                         0.3s 
------                                                                                                                                                        
 > [11/19] RUN bash INSTALL_NODB.sh -A -u:                                                                                                                    
#15 0.207 sha1 matches                                                                                                                                        
#15 0.220 sha256 matches                                                                                                                                      
#15 0.231 sha384 matches                                                                                                                                      
#15 0.243 sha512 matches                                                                                                                                      
#15 0.244 tput: No value for $TERM and no -T specified
#15 0.244 -
#15 0.253 The following DB Passwords were generated...
#15 0.253 Admin (root) DB Password: cde2bcf451ed82b56638d108beb7f544dc6f816a46644f7a2887eba0c50d2276
#15 0.253 User  (misp) DB Password: 997a75fe154b0fa1ec966b5570ffbf9ba44378ad60ff2cc351d06164d8848df9
#15 0.253 all
#15 0.253 unattended
#15 0.256     Either your platform is not easily detectable or is not supported by this
#15 0.256     installer script.
#15 0.256     Please visit the following URL for more detailed installation instructions:
#15 0.256     https://misp.github.io/MISP/
------
executor failed running [/bin/sh -c bash INSTALL_NODB.sh -A -u]: exit code: 1
ERROR: Service 'web' failed to build : Build failed

remarks

In the Docker ubuntu image (on M1 Mac), the output of "uname -m" is aarch64 as below.

...% docker run -it ubuntu:latest /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
5f3d23ccb99f: Already exists 
Digest: sha256:b5a61709a9a44284d88fb12e5c48db0409cfad5b69d4ff8224077c57302df9cf
Status: Downloaded newer image for ubuntu:latest
root@cec997cddba0:/# uname -m
aarch64

This seems to be the cause?

a-ml commented 2 years ago

Any development on this issue?

fukusuket commented 2 years ago

@a-ml

142 is a workaround for this issue.

You can apply the commit of #142 by following the steps below.

git clone https://github.com/MISP/misp-docker.git
cd misp-docker
git remote add fukusuket https://github.com/fukusuket/misp-docker.git
git fetch fukusuket 
git merge fukusuket/hotfix/build-error-on-m1-mac -m "add aarch64 support"

After the above, the rest of the steps is same as master.

cp template.env .env
docker-compose build
docker-compose up
...  (It takes about 15  ~ 20 minutes to complete docker-compose up.)