Open10

M1 Macのdocker環境でISUCON 4を動かす

fujiwofujiwo

M1 Macだとそのままだと動かない。
該当image群がarm対応していないため。

% curl -o docker-compose.yml -L https://github.com/matsuu/docker-isucon/raw/master/isucon4-qualifier/docker-compose-go.yml

% docker compose up -d
WARN[0000] /works/ffjlabo/isucon/isucon4-qualifier/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 2/4
 ⠇ webapp [⠀⠀⠀] Pulling                                                                                                                                                                                                                         2.8s
   ⠋ 08a7a0bb6122 Pulling fs layer                                                                                                                                                                                                              0.0s
   ⠋ 7f364785d06b Pulling fs layer                                                                                                                                                                                                              0.0s
   ⠋ 5273ca054186 Pulling fs layer                                                                                                                                                                                                              0.0s
 ✘ nginx Error                 context canceled                                                                                                                                                                                                 2.8s
 ⠇ mysql Pulling                                                                                                                                                                                                                                2.8s
 ✘ bench Error                 context canceled
fujiwofujiwo

独自にimageをbuildする必要がありそう。
今回はgoアプリケーションでチャレンジするので、以下の5つをbuildする。
https://github.com/matsuu/docker-isucon/tree/master/isucon4-qualifier

  • base
  • bench
  • mysql
  • nginx
  • webapp/go
fujiwofujiwo

base

~/oss/matsuu/docker-isucon/isucon4-qualifier
% docker build -f base/Dockerfile -t matsuu/isucon4-qualifier-base:latest ./base                                                                                                                                                      
[+] Building 2.1s (2/2) FINISHED                                                                                                                                                                                                     docker:orbstack
 => [internal] load build definition from Dockerfile                                                                                                                                                                                            0.1s
 => => transferring dockerfile: 1.25kB                                                                                                                                                                                                          0.0s
 => WARN: MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)                                                                                                                                           0.1s
 => ERROR [internal] load metadata for docker.io/library/centos:6                                                                                                                                                                               2.0s
------
 > [internal] load metadata for docker.io/library/centos:6:
------

 1 warning found (use docker --debug to expand):
 - MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)
Dockerfile:1
--------------------
   1 | >>> FROM centos:6
   2 |
   3 |     MAINTAINER matsuu@gmail.com
--------------------
ERROR: failed to solve: centos:6: failed to resolve source metadata for docker.io/library/centos:6: no match for platform in manifest: not found (did you mean centos?)

base imageのcentos:6がarm対応imageがなさそうだった。
Dockerfileを更新してcentos:7に

fujiwofujiwo

再度buildすると別のエラーが

% docker build -f base/Dockerfile -t matsuu/isucon4-qualifier-base:latest ./base                                                                                                                                                      
[+] Building 7.8s (5/5) FINISHED                                                                                                                                                                                                     docker:orbstack
 => [internal] load build definition from Dockerfile                                                                                                                                                                                            0.0s
 => => transferring dockerfile: 1.25kB                                                                                                                                                                                                          0.0s
 => WARN: MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/centos:7                                                                                                                                                                                     1.4s
 => [internal] load .dockerignore                                                                                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                                                                                 0.0s
 => [1/2] FROM docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4                                                                                                                               5.0s
 => => resolve docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4                                                                                                                               0.0s
 => => sha256:73f11afcbb50d8bc70eab9f0850b3fa30e61a419bc48cf426e63527d14a8373b 530B / 530B                                                                                                                                                      0.0s
 => => sha256:c9a1fdca3387618f8634949de4533419327736e2f5c618e3bfebe877aa331352 2.77kB / 2.77kB                                                                                                                                                  0.0s
 => => sha256:6717b8ec66cd6add0272c6391165585613c31314a43ff77d9751b53010e531ec 108.37MB / 108.37MB                                                                                                                                              1.8s
 => => sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4 1.20kB / 1.20kB                                                                                                                                                  0.0s
 => => extracting sha256:6717b8ec66cd6add0272c6391165585613c31314a43ff77d9751b53010e531ec                                                                                                                                                       3.0s
 => ERROR [2/2] RUN   yum -y update &&   yum -y install git mysql sudo &&   useradd -G wheel isucon &&   echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers &&   git clone https://github.com/isucon/isucon4.git &&   mkdir /tmp/isucon &&    1.2s
------
 > [2/2] RUN   yum -y update &&   yum -y install git mysql sudo &&   useradd -G wheel isucon &&   echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers &&   git clone https://github.com/isucon/isucon4.git &&   mkdir /tmp/isucon &&   rsync -a isucon4/qualifier/sql /tmp/isucon/ &&   rsync -a isucon4/qualifier/webapp /tmp/isucon/ &&   sed -e 's/127\.0\.0\.1/mysql/' isucon4/qualifier/init.sh > /tmp/isucon/init.sh &&   chmod a+x /tmp/isucon/init.sh &&   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /tmp/isucon/env.sh &&   chmod a+x /tmp/isucon/env.sh &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   mkdir -p /tmp/isucon/.local/php/etc &&   cp isucon4/qualifier/ami/files/php.ini /tmp/isucon/.local/php/etc/php.ini &&   chown -R isucon:isucon /tmp/isucon &&   rsync -avz --delete --exclude-from=isucon4/qualifier/ami/files/rsync_exclude.txt /tmp/isucon/ /home/isucon/ &&   sudo -u isucon git clone https://github.com/tagomoris/xbuild.git /home/isucon/.xbuild &&   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh &&   rm -rf isucon4 /tmp/isucon:
0.360 Loaded plugins: fastestmirror, ovl
0.412 Determining fastest mirrors
0.669 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=aarch64&repo=os&infra=container error was
0.669 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
0.669
0.669
0.669  One of the configured repositories failed (Unknown),
0.669  and yum doesn't have enough cached data to continue. At this point the only
0.669  safe thing yum can do is fail. There are a few ways to work "fix" this:
0.669
0.669      1. Contact the upstream for the repository and get them to fix the problem.
0.669
0.669      2. Reconfigure the baseurl/etc. for the repository, to point to a working
0.669         upstream. This is most often useful if you are using a newer
0.669         distribution release than is supported by the repository (and the
0.669         packages for the previous distribution release still work).
0.669
0.669      3. Run the command with the repository temporarily disabled
0.669             yum --disablerepo=<repoid> ...
0.669
0.669      4. Disable the repository permanently, so yum won't use it by default. Yum
0.669         will then just ignore the repository until you permanently enable it
0.669         again or use --enablerepo for temporary usage:
0.669
0.669             yum-config-manager --disable <repoid>
0.669         or
0.669             subscription-manager repos --disable=<repoid>
0.669
0.669      5. Configure the failing repository to be skipped, if it is unavailable.
0.669         Note that yum will try to contact the repo. when it runs most commands,
0.669         so will have to try and fail each time (and thus. yum will be be much
0.669         slower). If it is a very temporary problem though, this is often a nice
0.669         compromise:
0.669
0.669             yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
0.669
0.669 Cannot find a valid baseurl for repo: base/7/aarch64
------
Dockerfile:5
--------------------
   4 |
   5 | >>> RUN \
   6 | >>>   yum -y update && \
   7 | >>>   yum -y install git mysql sudo && \
   8 | >>>   useradd -G wheel isucon && \
   9 | >>>   echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
  10 | >>>   git clone https://github.com/isucon/isucon4.git && \
  11 | >>>   mkdir /tmp/isucon && \
  12 | >>>   rsync -a isucon4/qualifier/sql /tmp/isucon/ && \
  13 | >>>   rsync -a isucon4/qualifier/webapp /tmp/isucon/ && \
  14 | >>>   sed -e 's/127\.0\.0\.1/mysql/' isucon4/qualifier/init.sh > /tmp/isucon/init.sh && \
  15 | >>>   chmod a+x /tmp/isucon/init.sh && \
  16 | >>>   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /tmp/isucon/env.sh && \
  17 | >>>   chmod a+x /tmp/isucon/env.sh && \
  18 | >>>   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc && \
  19 | >>>   chmod a+x /home/isucon/.bashrc && \
  20 | >>>   mkdir -p /tmp/isucon/.local/php/etc && \
  21 | >>>   cp isucon4/qualifier/ami/files/php.ini /tmp/isucon/.local/php/etc/php.ini && \
  22 | >>>   chown -R isucon:isucon /tmp/isucon && \
  23 | >>>   rsync -avz --delete --exclude-from=isucon4/qualifier/ami/files/rsync_exclude.txt /tmp/isucon/ /home/isucon/ && \
  24 | >>>   sudo -u isucon git clone https://github.com/tagomoris/xbuild.git /home/isucon/.xbuild && \
  25 | >>>   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh && \
  26 | >>>   rm -rf isucon4 /tmp/isucon
  27 |
--------------------
ERROR: failed to solve: process "/bin/sh -c yum -y update &&   yum -y install git mysql sudo &&   useradd -G wheel isucon &&   echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers &&   git clone https://github.com/isucon/isucon4.git &&   mkdir /tmp/isucon &&   rsync -a isucon4/qualifier/sql /tmp/isucon/ &&   rsync -a isucon4/qualifier/webapp /tmp/isucon/ &&   sed -e 's/127\\.0\\.0\\.1/mysql/' isucon4/qualifier/init.sh > /tmp/isucon/init.sh &&   chmod a+x /tmp/isucon/init.sh &&   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /tmp/isucon/env.sh &&   chmod a+x /tmp/isucon/env.sh &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   mkdir -p /tmp/isucon/.local/php/etc &&   cp isucon4/qualifier/ami/files/php.ini /tmp/isucon/.local/php/etc/php.ini &&   chown -R isucon:isucon /tmp/isucon &&   rsync -avz --delete --exclude-from=isucon4/qualifier/ami/files/rsync_exclude.txt /tmp/isucon/ /home/isucon/ &&   sudo -u isucon git clone https://github.com/tagomoris/xbuild.git /home/isucon/.xbuild &&   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh &&   rm -rf isucon4 /tmp/isucon" did not complete successfully: exit code: 1

どうやらCentOSのmirror repoに設定されてる mirrorlist.centos.org が廃止されたっぽい
https://vault.centos.org/ を使うようにDockerfileを修正する
ref: https://qiita.com/vossibop/items/d4fc4c94e5b7714e3a8c

fujiwofujiwo

成功

% docker build -f base/Dockerfile -t matsuu/isucon4-qualifier-base:latest ./base                                                                                                                                                      
[+] Building 107.4s (6/6) FINISHED                                                                                                                                                                                                   docker:orbstack
 => [internal] load build definition from Dockerfile                                                                                                                                                                                            0.0s
 => => transferring dockerfile: 1.43kB                                                                                                                                                                                                          0.0s
 => WARN: MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/centos:7                                                                                                                                                                                     1.3s
 => [internal] load .dockerignore                                                                                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                                                                                 0.0s
 => CACHED [1/2] FROM docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4                                                                                                                        0.0s
 => [2/2] RUN   sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* &&   yum -y update &&   yum -y install git mysql  103.8s
 => exporting to image                                                                                                                                                                                                                          2.2s
 => => exporting layers                                                                                                                                                                                                                         2.2s
 => => writing image sha256:25408197cb7ab8441f8f181b686731e1ded79dc3a6a0fd0e288a0972418d849c                                                                                                                                                    0.0s
 => => naming to docker.io/matsuu/isucon4-qualifier-base:latest
fujiwofujiwo

bench
CentOS7対応を同様にしてビルドしたところ、エラーが発生

...
 CACHED [1/2] FROM docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4                                                                                                                        0.0s
 => ERROR [2/2] RUN   sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* &&   yum -y update &&   yum -y install gcc  111.8s
------
 > [2/2] RUN   sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* &&   yum -y update &&   yum -y install gcc git libxml2-devel mysql rubygems sudo &&   useradd -G wheel isucon &&   git clone https://github.com/isucon/isucon4.git &&   curl -L http://golang.org/dl/go1.3.linux-amd64.tar.gz | tar zxf - -C /usr/local &&   rsync -a isucon4/qualifier/sql /home/isucon/ &&   sed -e 's/127\.0\.0\.1/mysql/' isucon4/qualifier/init.sh > /home/isucon/init.sh &&   chmod a+x /home/isucon/init.sh &&   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /home/isucon/env.sh &&   chmod a+x /home/isucon/env.sh &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh &&   /usr/bin/gem install --no-rdoc --no-ri gondler -v 0.2.0 &&   rsync -aL --delete isucon4/qualifier/benchmarker /tmp/ &&   chown -R isucon:isucon /tmp/benchmarker &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   sed -i -e 's/^GIT_COMMIT=.*/GIT_COMMIT=""/' /tmp/benchmarker/Makefile &&   sed -i -e '/checkInstanceMetadata()/d' /tmp/benchmarker/main.go &&   (     cd /tmp/benchmarker &&     sudo -u isucon env TERM=xterm /home/isucon/env.sh make release   ) &&   mv /tmp/benchmarker/benchmarker /home/isucon/ &&   rm -rf /tmp/benchmarker isucon4:
0.299 Loaded plugins: fastestmirror, ovl
0.353 Determining fastest mirrors
8.261 Resolving Dependencies
8.262 --> Running transaction check
8.263 ---> Package bash.aarch64 0:4.2.46-34.el7 will be updated
8.276 ---> Package bash.aarch64 0:4.2.46-35.el7_9 will be an update
8.278 ---> Package bind-license.noarch 32:9.11.4-26.P2.el7 will be updated
8.278 ---> Package bind-license.noarch 32:9.11.4-26.P2.el7_9.16 will be an update
8.280 ---> Package binutils.aarch64 0:2.27-44.base.el7 will be updated
8.280 ---> Package binutils.aarch64 0:2.27-44.base.el7_9.1 will be an update
8.281 ---> Package ca-certificates.noarch 0:2020.2.41-70.0.el7_8 will be updated
8.281 ---> Package ca-certificates.noarch 0:2023.2.60_v7.0.306-72.el7_9 will be an update
8.282 ---> Package centos-release.aarch64 0:7-9.2009.0.el7.centos will be updated
8.283 ---> Package centos-release.aarch64 0:7-9.2009.2.el7.centos will be an update
8.283 ---> Package coreutils.aarch64 0:8.22-24.el7 will be updated
8.284 ---> Package coreutils.aarch64 0:8.22-24.el7_9.2 will be an update
8.287 ---> Package curl.aarch64 0:7.29.0-59.el7 will be updated
...
100.8   fipscheck-lib.aarch64 0:1.4.1-6.el7
100.8   glibc-devel.aarch64 0:2.17-326.el7_9.3
100.8   glibc-headers.aarch64 0:2.17-326.el7_9.3
100.8   groff-base.aarch64 0:1.22.2-8.el7
100.8   kernel-headers.aarch64 0:4.18.0-348.20.1.el7
100.8   less.aarch64 0:458-10.el7_9
100.8   libedit.aarch64 0:3.0-12.20121213cvs.el7
100.8   libgomp.aarch64 0:4.8.5-44.el7
100.8   libmpc.aarch64 0:1.0.1-3.el7
100.8   libyaml.aarch64 0:0.1.4-11.el7
100.8   mariadb-libs.aarch64 1:5.5.68-1.el7
100.8   mpfr.aarch64 0:3.1.1-4.el7
100.8   openssh.aarch64 0:7.4p1-23.el7_9
100.8   openssh-clients.aarch64 0:7.4p1-23.el7_9
100.8   perl.aarch64 4:5.16.3-299.el7_9
100.8   perl-Carp.noarch 0:1.26-244.el7
100.8   perl-Encode.aarch64 0:2.51-7.el7
100.8   perl-Error.noarch 1:0.17020-2.el7
100.8   perl-Exporter.noarch 0:5.68-3.el7
100.8   perl-File-Path.noarch 0:2.09-2.el7
100.8   perl-File-Temp.noarch 0:0.23.01-3.el7
100.8   perl-Filter.aarch64 0:1.49-3.el7
100.8   perl-Getopt-Long.noarch 0:2.40-3.el7
100.8   perl-Git.noarch 0:1.8.3.1-25.el7_9
100.8   perl-HTTP-Tiny.noarch 0:0.033-3.el7
100.8   perl-PathTools.aarch64 0:3.40-5.el7
100.8   perl-Pod-Escapes.noarch 1:1.04-299.el7_9
100.8   perl-Pod-Perldoc.noarch 0:3.20-4.el7
100.8   perl-Pod-Simple.noarch 1:3.28-4.el7
100.8   perl-Pod-Usage.noarch 0:1.63-3.el7
100.8   perl-Scalar-List-Utils.aarch64 0:1.27-248.el7
100.8   perl-Socket.aarch64 0:2.010-5.el7
100.8   perl-Storable.aarch64 0:2.45-3.el7
100.8   perl-TermReadKey.aarch64 0:2.30-20.el7
100.8   perl-Text-ParseWords.noarch 0:3.29-4.el7
100.8   perl-Time-HiRes.aarch64 4:1.9725-3.el7
100.8   perl-Time-Local.noarch 0:1.2300-2.el7
100.8   perl-constant.noarch 0:1.27-2.el7
100.8   perl-libs.aarch64 4:5.16.3-299.el7_9
100.8   perl-macros.aarch64 4:5.16.3-299.el7_9
100.8   perl-parent.noarch 1:0.225-244.el7
100.8   perl-podlators.noarch 0:2.5.1-3.el7
100.8   perl-threads.aarch64 0:1.87-4.el7
100.8   perl-threads-shared.aarch64 0:1.43-6.el7
100.8   rsync.aarch64 0:3.1.2-12.el7_9
100.8   ruby.aarch64 0:2.0.0.648-36.el7
100.8   ruby-irb.noarch 0:2.0.0.648-36.el7
100.8   ruby-libs.aarch64 0:2.0.0.648-36.el7
100.8   rubygem-bigdecimal.aarch64 0:1.2.0-36.el7
100.8   rubygem-io-console.aarch64 0:0.4.2-36.el7
100.8   rubygem-json.aarch64 0:1.7.7-36.el7
100.8   rubygem-psych.aarch64 0:2.0.0-36.el7
100.8   rubygem-rdoc.noarch 0:4.0.0-36.el7
100.8   xz-devel.aarch64 0:5.2.2-2.el7_9
100.8   zlib-devel.aarch64 0:1.2.7-21.el7_9
100.8
100.8 Complete!
100.9 Cloning into 'isucon4'...
102.7   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
102.7                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    77  100    77    0     0    142      0 --:--:-- --:--:-- --:--:--   142
100    72  100    72    0     0     77      0 --:--:-- --:--:-- --:--:--   225
100 48.7M  100 48.7M    0     0  12.1M      0  0:00:04  0:00:04 --:--:-- 20.0M
110.9 Successfully installed thor-0.18.1
110.9 Successfully installed gondler-0.2.0
110.9 2 gems installed
111.0 /home/isucon/env.sh: line 23: exec: make: not found
------

 1 warning found (use docker --debug to expand):
 - MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)
Dockerfile:5
--------------------
   4 |
   5 | >>> RUN \
   6 | >>>   sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
   7 | >>>   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
   8 | >>>   yum -y update && \
   9 | >>>   yum -y install gcc git libxml2-devel mysql rubygems sudo && \
  10 | >>>   useradd -G wheel isucon && \
  11 | >>>   git clone https://github.com/isucon/isucon4.git && \
  12 | >>>   curl -L http://golang.org/dl/go1.3.linux-amd64.tar.gz | tar zxf - -C /usr/local && \
  13 | >>>   rsync -a isucon4/qualifier/sql /home/isucon/ && \
  14 | >>>   sed -e 's/127\.0\.0\.1/mysql/' isucon4/qualifier/init.sh > /home/isucon/init.sh && \
  15 | >>>   chmod a+x /home/isucon/init.sh && \
  16 | >>>   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /home/isucon/env.sh && \
  17 | >>>   chmod a+x /home/isucon/env.sh && \
  18 | >>>   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc && \
  19 | >>>   chmod a+x /home/isucon/.bashrc && \
  20 | >>>   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh && \
  21 | >>>   /usr/bin/gem install --no-rdoc --no-ri gondler -v 0.2.0 && \
  22 | >>>   rsync -aL --delete isucon4/qualifier/benchmarker /tmp/ && \
  23 | >>>   chown -R isucon:isucon /tmp/benchmarker && \
  24 | >>>   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc && \
  25 | >>>   chmod a+x /home/isucon/.bashrc && \
  26 | >>>   sed -i -e 's/^GIT_COMMIT=.*/GIT_COMMIT=""/' /tmp/benchmarker/Makefile && \
  27 | >>>   sed -i -e '/checkInstanceMetadata()/d' /tmp/benchmarker/main.go && \
  28 | >>>   ( \
  29 | >>>     cd /tmp/benchmarker && \
  30 | >>>     sudo -u isucon env TERM=xterm /home/isucon/env.sh make release \
  31 | >>>   ) && \
  32 | >>>   mv /tmp/benchmarker/benchmarker /home/isucon/ && \
  33 | >>>   rm -rf /tmp/benchmarker isucon4
  34 |
--------------------
ERROR: failed to solve: process "/bin/sh -c sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* &&   yum -y update &&   yum -y install gcc git libxml2-devel mysql rubygems sudo &&   useradd -G wheel isucon &&   git clone https://github.com/isucon/isucon4.git &&   curl -L http://golang.org/dl/go1.3.linux-amd64.tar.gz | tar zxf - -C /usr/local &&   rsync -a isucon4/qualifier/sql /home/isucon/ &&   sed -e 's/127\\.0\\.0\\.1/mysql/' isucon4/qualifier/init.sh > /home/isucon/init.sh &&   chmod a+x /home/isucon/init.sh &&   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /home/isucon/env.sh &&   chmod a+x /home/isucon/env.sh &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh &&   /usr/bin/gem install --no-rdoc --no-ri gondler -v 0.2.0 &&   rsync -aL --delete isucon4/qualifier/benchmarker /tmp/ &&   chown -R isucon:isucon /tmp/benchmarker &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   sed -i -e 's/^GIT_COMMIT=.*/GIT_COMMIT=\"\"/' /tmp/benchmarker/Makefile &&   sed -i -e '/checkInstanceMetadata()/d' /tmp/benchmarker/main.go &&   (     cd /tmp/benchmarker &&     sudo -u isucon env TERM=xterm /home/isucon/env.sh make release   ) &&   mv /tmp/benchmarker/benchmarker /home/isucon/ &&   rm -rf /tmp/benchmarker isucon4" did not complete successfully: exit code: 127

makeコマンドがデフォルトでなかったようなので、yum install にmakeを追加。

fujiwofujiwo

再度実行するとエラー

gondler というツールがx86_64にしか対応していないので、docker buildxでplatformをlinux/amd64にしてビルドし直す

fujiwofujiwo

さらに今度はツールの問題

gondler install 時に、対象のrepoのmasterブランチをcheckoutしようとしてるが、このrepoではmainブランチ運用に切り替わっているので別途対応が必要

cd /tmp/benchmarker/.gondler/src/github.com/codegangsta/cli; git checkout master
% docker buildx build --platform=linux/amd64 -f bench/Dockerfile -t matsuu/isucon4-qualifier-base:latest ./bench
...
100 48.7M  100 48.7M    0     0  5540k      0  0:00:09  0:00:09 --:--:-- 6897k
73.21 Successfully installed thor-0.18.1
73.21 Successfully installed gondler-0.2.0
73.21 2 gems installed
73.51 --> Installing build dependencies
73.51 gondler install
73.67 Install github.com/codegangsta/cli
75.80 github.com/codegangsta/cli download error
75.80 # cd /tmp/benchmarker/.gondler/src/github.com/codegangsta/cli; git checkout master
75.80 error: pathspec 'master' did not match any file(s) known to git.
75.80 package github.com/codegangsta/cli: exit status 1
75.80 make: *** [.gondler] Error 1
------

 1 warning found (use docker --debug to expand):
 - MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 3)
Dockerfile:5
--------------------
   4 |
   5 | >>> RUN \
   6 | >>>   sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
   7 | >>>   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
   8 | >>>   yum -y update && \
   9 | >>>   yum -y install gcc git libxml2-devel mysql rubygems sudo make && \
  10 | >>>   useradd -G wheel isucon && \
  11 | >>>   git clone https://github.com/isucon/isucon4.git && \
  12 | >>>   curl -L http://golang.org/dl/go1.3.linux-amd64.tar.gz | tar zxf - -C /usr/local && \
  13 | >>>   rsync -a isucon4/qualifier/sql /home/isucon/ && \
  14 | >>>   sed -e 's/127\.0\.0\.1/mysql/' isucon4/qualifier/init.sh > /home/isucon/init.sh && \
  15 | >>>   chmod a+x /home/isucon/init.sh && \
  16 | >>>   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /home/isucon/env.sh && \
  17 | >>>   chmod a+x /home/isucon/env.sh && \
  18 | >>>   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc && \
  19 | >>>   chmod a+x /home/isucon/.bashrc && \
  20 | >>>   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh && \
  21 | >>>   /usr/bin/gem install --no-rdoc --no-ri gondler -v 0.2.0 && \
  22 | >>>   rsync -aL --delete isucon4/qualifier/benchmarker /tmp/ && \
  23 | >>>   chown -R isucon:isucon /tmp/benchmarker && \
  24 | >>>   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc && \
  25 | >>>   chmod a+x /home/isucon/.bashrc && \
  26 | >>>   sed -i -e 's/^GIT_COMMIT=.*/GIT_COMMIT=""/' /tmp/benchmarker/Makefile && \
  27 | >>>   sed -i -e '/checkInstanceMetadata()/d' /tmp/benchmarker/main.go && \
  28 | >>>   ( \
  29 | >>>     cd /tmp/benchmarker && \
  30 | >>>     sudo -u isucon env TERM=xterm /home/isucon/env.sh make release \
  31 | >>>   ) && \
  32 | >>>   mv /tmp/benchmarker/benchmarker /home/isucon/ && \
  33 | >>>   rm -rf /tmp/benchmarker isucon4
  34 |
--------------------
ERROR: failed to solve: process "/bin/sh -c sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* &&   sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* &&   yum -y update &&   yum -y install gcc git libxml2-devel mysql rubygems sudo make &&   useradd -G wheel isucon &&   git clone https://github.com/isucon/isucon4.git &&   curl -L http://golang.org/dl/go1.3.linux-amd64.tar.gz | tar zxf - -C /usr/local &&   rsync -a isucon4/qualifier/sql /home/isucon/ &&   sed -e 's/127\\.0\\.0\\.1/mysql/' isucon4/qualifier/init.sh > /home/isucon/init.sh &&   chmod a+x /home/isucon/init.sh &&   sed -e 's/localhost/mysql/' isucon4/qualifier/ami/files/env.sh > /home/isucon/env.sh &&   chmod a+x /home/isucon/env.sh &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   cp isucon4/qualifier/ami/files/golang.sh /etc/profile.d/golang.sh &&   /usr/bin/gem install --no-rdoc --no-ri gondler -v 0.2.0 &&   rsync -aL --delete isucon4/qualifier/benchmarker /tmp/ &&   chown -R isucon:isucon /tmp/benchmarker &&   cp isucon4/qualifier/ami/files/bashrc /home/isucon/.bashrc &&   chmod a+x /home/isucon/.bashrc &&   sed -i -e 's/^GIT_COMMIT=.*/GIT_COMMIT=\"\"/' /tmp/benchmarker/Makefile &&   sed -i -e '/checkInstanceMetadata()/d' /tmp/benchmarker/main.go &&   (     cd /tmp/benchmarker &&     sudo -u isucon env TERM=xterm /home/isucon/env.sh make release   ) &&   mv /tmp/benchmarker/benchmarker /home/isucon/ &&   rm -rf /tmp/benchmarker isucon4" did not complete successfully: exit code: 2
fujiwofujiwo

このまま進むのは難しいので、一旦ストップ