Docker buildでのエラー

実現したいこと

https://qiita.com/YuH25/items/58fa7109ac4579780a85
このサイトを参考にDocker + PyTorchの環境を構築したいです。
環境
GPU: NVIDIA RTX A5000 CUDA Version 12.2
ホストOS: Windows 11
Docker: 24.0.7
Dockerのバックエンド: Ubuntu 24.04 (on WSL2)

nvcc
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0

発生している問題・分からないこと

サイトの3まで完了したのですが、docker buildを実行したらエラーがでます。
私のCUDAは11.7なのでサイトとはバージョンを変えてインストールしました。

該当のソースコード

Dockerfile

1FROM nvcr.io/nvidia/cuda:11.7.1-base-ubuntu22.04 2 3USER root 4 5RUN sudo apt-get update && apt-get install -y python3-pip 6 7RUN python3 -m pip install --upgrade pip \ 8 && python3 -m pip install --no-cache-dir \ 9 torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117 10 11RUN python3 -m pip install --no-cache-dir jupyter 12 13RUN apt-get autoremove -y && \ 14 apt-get clean && \ 15 rm -rf /usr/local/src/*

docker

1Client:2 Version: 24.0.7 3 Context: default 4 Debug Mode: false 5 Plugins:6 buildx: Docker Buildx (Docker Inc.) 7 Version: v0.14.1-desktop.1 8 Path: /usr/local/lib/docker/cli-plugins/docker-buildx 9 compose: Docker Compose (Docker Inc.) 10 Version: v2.27.1-desktop.1 11 Path: /usr/local/lib/docker/cli-plugins/docker-compose 12 debug: Get a shell into any image or container (Docker Inc.) 13 Version: 0.0.32 14 Path: /usr/local/lib/docker/cli-plugins/docker-debug 15 dev: Docker Dev Environments (Docker Inc.) 16 Version: v0.1.2 17 Path: /usr/local/lib/docker/cli-plugins/docker-dev 18 extension: Manages Docker extensions (Docker Inc.) 19 Version: v0.2.24 20 Path: /usr/local/lib/docker/cli-plugins/docker-extension 21 feedback: Provide feedback, right in your terminal! (Docker Inc.) 22 Version: v1.0.5 23 Path: /usr/local/lib/docker/cli-plugins/docker-feedback 24 init: Creates Docker-related starter files for your project (Docker Inc.) 25 Version: v1.2.0 26 Path: /usr/local/lib/docker/cli-plugins/docker-init 27 sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.) 28 Version: 0.6.0 29 Path: /usr/local/lib/docker/cli-plugins/docker-sbom 30 scout: Docker Scout (Docker Inc.) 31 Version: v1.9.3 32 Path: /usr/local/lib/docker/cli-plugins/docker-scout 33 34Server:35 Containers: 0 36 Running: 0 37 Paused: 0 38 Stopped: 0 39 Images: 1 40 Server Version: 24.0.7 41 Storage Driver: overlay2 42 Backing Filesystem: extfs 43 Supports d_type: true 44 Using metacopy: false 45 Native Overlay Diff: true 46 userxattr: false 47 Logging Driver: json-file 48 Cgroup Driver: cgroupfs 49 Cgroup Version: 1 50 Plugins:51 Volume: local 52 Network: bridge host ipvlan macvlan null overlay 53 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog 54 Swarm: inactive 55 Runtimes: io.containerd.runc.v2 nvidia runc 56 Default Runtime: nvidia 57 Init Binary: docker-init 58 containerd version:59 runc version: ddeeca392c7bd8b33d0a66400b77af7a97e16cef 60 init version:61 Security Options:62 seccomp 63 Profile: builtin 64 Kernel Version: 5.15.153.1-microsoft-standard-WSL2 65 Operating System: Ubuntu 24.04 LTS 66 OSType: linux 67 Architecture: x86_64 68 CPUs: 32 69 Total Memory: 62.62GiB 70 Name: DG173 71 ID: 903859cf-e2da-4627-9bab-e646ae14ed64 72 Docker Root Dir: /var/lib/docker 73 Debug Mode: false 74 HTTP Proxy: http://ykkproxy.ykk.jpn.ykkglobal:3128 75 HTTPS Proxy: http://ykkproxy.ykk.jpn.ykkglobal:3128 76 Experimental: false 77 Insecure Registries:78 127.0.0.0/8 79 Live Restore Enabled: false 80 81WARNING: No blkio throttle.read_bps_device support 82WARNING: No blkio throttle.write_bps_device support 83WARNING: No blkio throttle.read_iops_device support 84WARNING: No blkio throttle.write_iops_device support

試したこと・調べたこと

上記の詳細・結果

下記がbuildを実行したときのエラーとなります。
[+] Building 0.8s (5/8) docker:default
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 469B 0.0s
=> [internal] load metadata for nvcr.io/nvidia/cuda:11.7.1-base-ubuntu22.04 0.0s
=> CACHED [1/5] FROM nvcr.io/nvidia/cuda:11.7.1-base-ubuntu22.04 0.0s
=> ERROR [2/5] RUN sudo apt-get update && apt-get install -y python3-pip 0.6s

[2/5] RUN sudo apt-get update && apt-get install -y python3-pip:

0.510 /bin/sh: 1: sudo: not found
Dockerfile:5
3 | USER root
4 |
5 | >>> RUN sudo apt-get update && apt-get install -y python3-pip
6 |
7 | RUN python3 -m pip install --upgrade pip
ERROR: failed to solve: process "/bin/sh -c sudo apt-get update && apt-get install -y python3-pip" did not complete successfully: exit code: 127

補足

特になし

コメントを投稿

0 コメント