余っているPC(もう2年ぐらい放置)にUbuntuを入れてリハビリをしよう。
導入
仕事をしてたのは去年までなので、4月以降あんまり触っていない。とりあえず、仕事で触っていたツールの最新を触ってみようぐらいのノリ。
Bリーグあたりのマジック計算をしてみたい(好奇心)だけ。完成するかは不明。
業務で使っていたJenkinsとVueとDockerあたりでやってみる。
docker compose V2
install
V2が4月に出たわけで、使ったことがない。ので使ってみよう。
インストール方法は公式参照。(Install using the repositoryで実施した)
$ docker version
Client: Docker Engine - Community
Version: 20.10.20
API version: 1.41
Go version: go1.18.7
Git commit: 9fdeb9c
Built: Tue Oct 18 18:20:18 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.20
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 03df974
Built: Tue Oct 18 18:18:08 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
$ docker compose version
Docker Compose version v2.12.0
と、インストールまではできてそう。
Try Docker Compose
動かしたいものが上手く動かなったので、とりあえずはチュートリアルをそのままやってみる。
$ docker compose up -d --build
[+] Running 7/7
⠿ redis Pulled 6.1s
⠿ 213ec9aee27d Pull complete 1.0s
⠿ fb541f77610a Pull complete 1.1s
⠿ dc2e3041aaa5 Pull complete 1.2s
⠿ aadae582a31f Pull complete 2.1s
⠿ 996b5def1876 Pull complete 2.2s
⠿ bed3be2507e6 Pull complete 2.2s
[+] Building 18.9s (11/14)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 320B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 2.5s
=> docker-image://docker.io/docker/dockerfile:1@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 0.9s
=> => resolve docker.io/docker/dockerfile:1@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 0.0s
=> => sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 2.00kB / 2.00kB 0.0s
=> => sha256:ad87fb03593d1b71f9a1cfc1406c4aafcb253b1dabebf569768d6e6166836f34 528B / 528B 0.0s
=> => sha256:1e8a16826fd1c80a63fa6817a9c7284c94e40cded14a9b0d0d3722356efa47bd 2.37kB / 2.37kB 0.0s
=> => sha256:1328b32c40fca9bcf9d70d8eccb72eb873d1124d72dadce04db8badbe7b08546 9.94MB / 9.94MB 0.6s
=> => extracting sha256:1328b32c40fca9bcf9d70d8eccb72eb873d1124d72dadce04db8badbe7b08546 0.2s
=> [internal] load .dockerignore 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> [internal] load metadata for docker.io/library/python:3.7-alpine 2.1s
=> [internal] load build context 0.0s
=> => transferring context: 1.08kB 0.0s
=> [1/6] FROM docker.io/library/python:3.7-alpine@sha256:45438a907ad35872739d31a5ae28a72a79c3f6abb43ec0b32688216e1ea1759c 2.3s
=> => resolve docker.io/library/python:3.7-alpine@sha256:45438a907ad35872739d31a5ae28a72a79c3f6abb43ec0b32688216e1ea1759c 0.0s
=> => sha256:dedec9fb414999ece43a424380467f77c07c6a9fb83f2c85d3131519ffc9c4d3 7.71kB / 7.71kB 0.0s
=> => sha256:47858aee13bf9c7c2b62cfaccdc9ce2524efef339df0c0ed8935c6587a376d60 673.19kB / 673.19kB 0.5s
=> => sha256:21d1eb95d7874516e8447cc3067020af49c4fb512abc36162c174c0d0c22bf50 11.16MB / 11.16MB 1.2s
=> => sha256:17ac4101fac6ced0416dec3e04584d913e58bfd5a585dff62f684807d10ac77e 230B / 230B 0.5s
=> => sha256:45438a907ad35872739d31a5ae28a72a79c3f6abb43ec0b32688216e1ea1759c 1.65kB / 1.65kB 0.0s
=> => sha256:a5307d13c6e13cc579014c5f475a5e7193bc20cb5fadd228eb700a94cc3eb7d3 1.37kB / 1.37kB 0.0s
=> => extracting sha256:47858aee13bf9c7c2b62cfaccdc9ce2524efef339df0c0ed8935c6587a376d60 0.1s
=> => sha256:131ff38582db7aad063095cd5e75c4b555f15cde5d02444b5d67605ab4c0f303 2.88MB / 2.88MB 1.8s
=> => extracting sha256:21d1eb95d7874516e8447cc3067020af49c4fb512abc36162c174c0d0c22bf50 0.3s
=> => extracting sha256:17ac4101fac6ced0416dec3e04584d913e58bfd5a585dff62f684807d10ac77e 0.0s
=> => extracting sha256:131ff38582db7aad063095cd5e75c4b555f15cde5d02444b5d67605ab4c0f303 0.2s
=> [2/6] WORKDIR /code 0.4s
=> ERROR [3/6] RUN apk add --no-cache gcc musl-dev linux-headers 10.3s
------
> [3/6] RUN apk add --no-cache gcc musl-dev linux-headers:
#0 0.273 fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
#0 5.278 fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
#0 5.278 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/main: temporary error (try again later)
#0 10.28 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/community: temporary error (try again later)
#0 10.28 ERROR: unable to select packages:
#0 10.28 gcc (no such package):
#0 10.28 required by: world[gcc]
#0 10.28 linux-headers (no such package):
#0 10.28 required by: world[linux-headers]
#0 10.28 musl-dev (no such package):
#0 10.28 required by: world[musl-dev]
------
failed to solve: executor failed running [/bin/sh -c apk add --no-cache gcc musl-dev linux-headers]: exit code: 3
なんか失敗したけど、コマンド自体は動いていた。
よくよく見ると、ファイル名間違っているだけでした。
$ docker compose up -d --build
[+] Building 13.9s (9/9) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 144B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.10.8 0.0s
=> [1/4] FROM docker.io/library/python:3.10.8 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 216B 0.0s
=> CACHED [2/4] WORKDIR /app 0.0s
=> CACHED [3/4] COPY . . 0.0s
=> [4/4] RUN pip install -r requirements.txt 12.9s
=> exporting to image 0.9s
=> => exporting layers 0.8s
=> => writing image sha256:90966a6d1d819749e14ad7bb82348c6134291a8f125b849f33a947c806aa2165 0.0s
=> => naming to docker.io/library/bleague-app 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 3/3
⠿ Network bleague_default Created 0.0s
⠿ Container bleague-selenium-1 Started 0.7s
⠿ Container bleague-app-1 Started
nameserverは、1回エラーしたので「8.8.8.8」を追加して、docker再起動はした。
コマンドのハイフンがなくなっていたり、コンテナ名の命名規則が変わっていたりを気を付ければ大丈夫かな?
結論
ちゃんとチュートリアルをやってみるのは大事
コピペで動かなかったら考える。
コメント