カテゴリー
[ラズパイ x puppeteer] Alpine:edgeのdockerイメージをラズパイにプルしてpuppeteerが動くか試すまでのお話
※ 当ページには【広告/PR】を含む場合があります。
2021/01/18
Puppeteerの使い方の基礎を解説! Puppeteer入門 スクレイピング+Web操作自動処理プログラミング
Puppeteerには64bitベースのOSを使おう
Puppeteerの使い方の基礎を解説! Puppeteer入門 スクレイピング+Web操作自動処理プログラミング
ラズパイでpuppeteerをインストール
上手くいかない例: 通常のRaspberry Pi OS (32bit)を使ってみる
alpine:edge
$ docker pull alpine:edge
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine edge 904d557dd3a3 3 weeks ago 3.82MB
...
$ docker run --rm -it alpine:edge sh
/# uname -a
Linux 1acab526291a 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l Linux
$ docker --version
Docker version 19.03.12, build 48a6621
$ docker-compose --version
docker-compose version 1.25.5, build 8a1c60f6
$ docker-compose build
Building app
Step 1/7 : FROM alpine:edge
---> 904d557dd3a3
Step 2/7 : RUN apk update && apk upgrade && apk add --no-cache bash openssh expect
---> Running in 76dc8b73963d
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/armv7/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/edge/main: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/edge/main: No such file or directory
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/armv7/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/edge/community: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/edge/community: No such file or directory
2 errors; 14 distinct packages available
ERROR: Service 'app' failed to build: The command '/bin/sh -c apk update && apk upgrade && ...' returned a non-zero code: 2
$ docker run --rm -it alpine:edge apk info
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/edge/main: No such file or directory
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/edge/community: No such file or directory
musl
busybox
alpine-baselayout
alpine-keys
libcrypto1.1
libssl1.1
ca-certificates-bundle
libtls-standalone
ssl_client
zlib
apk-tools
scanelf
musl-utils
libc-utils
dockerをアップデートせよ
docker
$ sudo apt-get update && sudo apt-get install docker-ce
$ docker --version
Docker version 20.10.2, build 2291f61
alpine:edge
$ docker run --rm -it alpine:edge
/ # ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
ping: clock_gettime(MONOTONIC) failed
alpine:edge
$ docker run --rm -it arm32v7/alpine:3.11
/ # ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.290 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.278 ms
64 bytes from 127.0.0.1: seq=2 ttl=64 time=0.271 ms
64 bytes from 127.0.0.1: seq=3 ttl=64 time=0.269 ms
64 bytes from 127.0.0.1: seq=4 ttl=64 time=0.275 ms
64 bytes from 127.0.0.1: seq=5 ttl=64 time=0.276 ms
--- 127.0.0.1 ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max = 0.269/0.275/0.290 ms
This problem only happens on the raspberry pi with 32bit os with alpine:edge armhf
Puppeteerの使い方の基礎を解説! Puppeteer入門 スクレイピング+Web操作自動処理プログラミング
上手く例: ベータ版のRaspberry Pi OS (64bit)を使ってみる
$ uname -a
Linux raspberrypi 5.10.5-v8+ #1392 SMP PREEMPT Sat Jan 9 18:56:30 GMT 2021 aarch64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
alpine:edge
$ docker pull alpine:edge
$ docker run --rm -it alpine:edge
/# uname -a
Linux c3f81c1d71cb 5.10.5-v8+ #1392 SMP PREEMPT Sat Jan 9 18:56:30 GMT 2021 aarch64 Linux
#👇pingを叩くと反応あり
/# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.214 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.238 ms
64 bytes from 127.0.0.1: seq=2 ttl=64 time=0.224 ms
64 bytes from 127.0.0.1: seq=3 ttl=64 time=0.254 ms
64 bytes from 127.0.0.1: seq=4 ttl=64 time=0.229 ms
--- localhost ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.214/0.231/0.254 ms
$ docker-compose build
Building app
Step 1/7 : FROM alpine:edge
---> 9079f290228e
Step 2/7 : RUN apk update && apk upgrade && apk add --no-cache bash openssh expect
---> Running in 02b3d58d9141
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/aarch64/APKINDEX.tar.gz
v3.13.0-156-gb9f6e9e586 [https://dl-cdn.alpinelinux.org/alpine/edge/main]
v3.13.0-168-gc177701a68 [https://dl-cdn.alpinelinux.org/alpine/edge/community]
OK: 13805 distinct packages available
Upgrading critical system libraries and apk-tools:
(1/1) Upgrading apk-tools (2.12.0-r3 -> 2.12.0-r4)
#...省略
Removing intermediate container 671b64657589
---> adcd7e21988d
Successfully built adcd7e21988d
Successfully tagged puppeteer-alpine:edge
Puppeteerの使い方の基礎を解説! Puppeteer入門 スクレイピング+Web操作自動処理プログラミング
まとめ
記事を書いた人
ナンデモ系エンジニア
主にAngularでフロントエンド開発することが多いです。 開発環境はLinuxメインで進めているので、シェルコマンドも多用しております。 コツコツとプログラミングするのが好きな人間です。
カテゴリー