-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
現象
"演習2 Dockerコンテナイメージを作成する" のイメージビルドの手順にて、コマンドを実行すると次のように出力して失敗します。
sakaguchi-t@tsakaguchi:~/bootcamp$ git clone https://github.com/docker/getting-started.git
Cloning into 'getting-started'...
remote: Enumerating objects: 980, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 980 (delta 5), reused 1 (delta 1), pack-reused 971 (from 2)
Receiving objects: 100% (980/980), 5.28 MiB | 3.98 MiB/s, done.
Resolving deltas: 100% (523/523), done.
sakaguchi-t@tsakaguchi:~/bootcamp$ cd getting-started
docker build -t iijbootcamp_docker01 .
[+] Building 11.4s (12/26) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.22kB 0.0s
=> WARN: RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior (line 38 0.0s
=> [internal] load metadata for docker.io/library/python:alpine 4.7s
=> [internal] load metadata for docker.io/library/node:18-alpine 4.3s
=> [internal] load metadata for docker.io/library/nginx:alpine 4.4s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 67B 0.0s
=> [app-base 1/5] FROM docker.io/library/node:18-alpine@sha256:291dbe40243c47dc85fdc3690bc8edf17891dd02eaba36c577fbe73a45b97334 0.0s
=> [base 1/4] FROM docker.io/library/python:alpine@sha256:323a717dc4a010fee21e3f1aac738ee10bb485de4e7593ce242b36ee48d6b352 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 12.91MB 0.0s
=> [stage-6 1/3] FROM docker.io/library/nginx:alpine@sha256:4ff102c5d78d254a6f0da062b3cf39eaf07f01eec0927fd21e219d0af8bc0591 0.0s
=> CACHED [base 2/4] WORKDIR /app 0.0s
=> CACHED [base 3/4] COPY requirements.txt . 0.0s
=> ERROR [base 4/4] RUN pip install -r requirements.txt 6.5s
------
> [base 4/4] RUN pip install -r requirements.txt:
1.473 Collecting mkdocs==1.3.0 (from -r requirements.txt (line 1))
1.578 Downloading mkdocs-1.3.0-py3-none-any.whl.metadata (4.8 kB)
1.694 Collecting mkdocs-material==4.6.3 (from -r requirements.txt (line 2))
1.703 Downloading mkdocs_material-4.6.3-py2.py3-none-any.whl.metadata (4.1 kB)
1.738 Collecting mkdocs-minify-plugin==0.2.3 (from -r requirements.txt (line 3))
1.750 Downloading mkdocs-minify-plugin-0.2.3.tar.gz (3.0 kB)
1.767 Installing build dependencies: started
2.981 Installing build dependencies: finished with status 'done'
2.982 Getting requirements to build wheel: started
3.102 Getting requirements to build wheel: finished with status 'done'
3.102 Preparing metadata (pyproject.toml): started
3.208 Preparing metadata (pyproject.toml): finished with status 'done'
3.243 Collecting pygments==2.7.4 (from -r requirements.txt (line 4))
3.255 Downloading Pygments-2.7.4-py3-none-any.whl.metadata (1.9 kB)
3.307 Collecting pymdown-extensions==7.0 (from -r requirements.txt (line 5))
3.315 Downloading pymdown_extensions-7.0-py2.py3-none-any.whl.metadata (3.3 kB)
3.358 Collecting click>=3.3 (from mkdocs==1.3.0->-r requirements.txt (line 1))
3.369 Downloading click-8.1.8-py3-none-any.whl.metadata (2.3 kB)
3.411 Collecting Jinja2>=2.10.2 (from mkdocs==1.3.0->-r requirements.txt (line 1))
3.422 Downloading jinja2-3.1.5-py3-none-any.whl.metadata (2.6 kB)
3.461 Collecting Markdown>=3.2.1 (from mkdocs==1.3.0->-r requirements.txt (line 1))
3.471 Downloading Markdown-3.7-py3-none-any.whl.metadata (7.0 kB)
3.537 Collecting PyYAML>=3.10 (from mkdocs==1.3.0->-r requirements.txt (line 1))
3.546 Downloading PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl.metadata (2.1 kB)
3.617 Collecting watchdog>=2.0 (from mkdocs==1.3.0->-r requirements.txt (line 1))
3.625 Downloading watchdog-6.0.0.tar.gz (131 kB)
3.659 Installing build dependencies: started
4.626 Installing build dependencies: finished with status 'done'
4.627 Getting requirements to build wheel: started
4.734 Getting requirements to build wheel: finished with status 'done'
4.735 Preparing metadata (pyproject.toml): started
4.847 Preparing metadata (pyproject.toml): finished with status 'done'
4.868 Collecting ghp-import>=1.0 (from mkdocs==1.3.0->-r requirements.txt (line 1))
4.878 Downloading ghp_import-2.1.0-py3-none-any.whl.metadata (7.2 kB)
4.913 Collecting pyyaml-env-tag>=0.1 (from mkdocs==1.3.0->-r requirements.txt (line 1))
4.924 Downloading pyyaml_env_tag-0.1-py3-none-any.whl.metadata (4.1 kB)
4.997 Collecting importlib-metadata>=4.3 (from mkdocs==1.3.0->-r requirements.txt (line 1))
5.005 Downloading importlib_metadata-8.6.1-py3-none-any.whl.metadata (4.7 kB)
5.044 Collecting packaging>=20.5 (from mkdocs==1.3.0->-r requirements.txt (line 1))
5.051 Downloading packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
5.085 Collecting mergedeep>=1.3.4 (from mkdocs==1.3.0->-r requirements.txt (line 1))
5.097 Downloading mergedeep-1.3.4-py3-none-any.whl.metadata (4.3 kB)
5.150 Collecting htmlmin>=0.1.4 (from mkdocs-minify-plugin==0.2.3->-r requirements.txt (line 3))
5.161 Downloading htmlmin-0.1.12.tar.gz (19 kB)
5.180 Installing build dependencies: started
6.158 Installing build dependencies: finished with status 'done'
6.158 Getting requirements to build wheel: started
6.244 Getting requirements to build wheel: finished with status 'error'
6.247 error: subprocess-exited-with-error
6.247
6.247 × Getting requirements to build wheel did not run successfully.
6.247 │ exit code: 1
6.247 ╰─> [27 lines of output]
6.247 Traceback (most recent call last):
6.247 File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
6.247 main()
6.247 ~~~~^^
6.247 File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
6.247 json_out['return_val'] = hook(**hook_input['kwargs'])
6.247 ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
6.247 File "/usr/local/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
6.247 return hook(config_settings)
6.247 File "/tmp/pip-build-env-l0v7o2e9/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
6.247 return self._get_build_requires(config_settings, requirements=[])
6.247 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.247 File "/tmp/pip-build-env-l0v7o2e9/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
6.247 self.run_setup()
6.247 ~~~~~~~~~~~~~~^^
6.247 File "/tmp/pip-build-env-l0v7o2e9/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 522, in run_setup
6.247 super().run_setup(setup_script=setup_script)
6.247 ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.247 File "/tmp/pip-build-env-l0v7o2e9/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 320, in run_setup
6.247 exec(code, locals())
6.247 ~~~~^^^^^^^^^^^^^^^^
6.247 File "<string>", line 4, in <module>
6.247 File "/tmp/pip-install-2kq4eksk/htmlmin_8a742917deee489d9daf859a1e5861bf/htmlmin/__init__.py", line 28, in <module>
6.247 from .main import minify, Minifier
6.247 File "/tmp/pip-install-2kq4eksk/htmlmin_8a742917deee489d9daf859a1e5861bf/htmlmin/main.py", line 28, in <module>
6.247 import cgi
6.247 ModuleNotFoundError: No module named 'cgi'
6.247 [end of output]
6.247
6.247 note: This error originates from a subprocess, and is likely not a problem with pip.
6.391
6.391 [notice] A new release of pip is available: 24.3.1 -> 25.0.1
6.391 [notice] To update, run: pip install --upgrade pip
6.393 error: subprocess-exited-with-error
6.393
6.393 × Getting requirements to build wheel did not run successfully.
6.393 │ exit code: 1
6.393 ╰─> See above for output.
6.393
6.393 note: This error originates from a subprocess, and is likely not a problem with pip.
------
1 warning found (use docker --debug to expand):
- RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior (line 38)
Dockerfile:6
--------------------
4 | WORKDIR /app
5 | COPY requirements.txt .
6 | >>> RUN pip install -r requirements.txt
7 |
8 | FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
動作環境
- Windows 11 WSL2のUbuntu 24.04.2 LTS
- Docker Engine - Community 27.5.1
原因
requirements.txtにあるmkdocs-minify-plugin==0.2.3が依存するhtmlminがcgiをimportしています。しかしpython 3.13にてcgiが廃止されたため、インストールに失敗します。
回避策
requirements.txt を次のように修正します。mkdocs-minify-pluginを0.6.4にすることで、htmlminへの依存がhtmlmin2になります。
mkdocs-minify-plugin-0.6.4がmkdocs1.4.1以上を要求するので変更します。
mkdocs==1.4.1
mkdocs-material==4.6.3
mkdocs-minify-plugin==0.6.4
pygments==2.7.4
pymdown-extensions==7.0
Metadata
Metadata
Assignees
Labels
No labels