简体   繁体   中英

Docker build fails in ubuntu 18.04 wsl2

I am trying to build docker image in my local machine, I am using docker desktop and ubuntu 18.04 distro wsl2.

It pulls the image successfully yet fails during the "RUN" phase.

I have tried many solutions provided yet no luck. Below is the error, if anybody has any clue please let me know. Been stuck with this since a while.

Docker Image:

FROM alpine:3.14
RUN apk add --no-cache mysql-client
ENTRYPOINT ["mysql"]

Error:

root@LAPTOP-BOSTG8L5:/home/abilash/alpine1# docker build .
[+] Building 14.4s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                    0.0s
 => => transferring dockerfile: 118B                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/alpine:3.14                                                                                                                                          3.3s
 => [1/2] FROM docker.io/library/alpine:3.14@sha256:4c869a63e1b7c0722fed1e402a6466610327c3b83bdddb94bd94fb71da7f638a                                                                                    0.7s
 => => resolve docker.io/library/alpine:3.14@sha256:4c869a63e1b7c0722fed1e402a6466610327c3b83bdddb94bd94fb71da7f638a                                                                                    0.0s
 => => sha256:dd53f409bf0bd55eac632f9e694fd190244fef5854a428bf3ae1e2b636577623 1.47kB / 1.47kB                                                                                                          0.0s
 => => sha256:c7ed990a2339ee598662849de4f56e2241399f5a32340c8c4a7bbd5378a12b5f 2.83MB / 2.83MB                                                                                                          0.6s
 => => sha256:4c869a63e1b7c0722fed1e402a6466610327c3b83bdddb94bd94fb71da7f638a 1.64kB / 1.64kB                                                                                                          0.0s
 => => sha256:92d13cc58a46e012300ef49924edc56de5642ada25c9a457dce4a6db59892650 528B / 528B                                                                                                              0.0s
 => => extracting sha256:c7ed990a2339ee598662849de4f56e2241399f5a32340c8c4a7bbd5378a12b5f                                                                                                               0.1s
 => ERROR [2/2] RUN apk add --no-cache mysql-client                                                                                                                                                    10.3s
------
 > [2/2] RUN apk add --no-cache mysql-client:
#4 0.293 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
#4 5.299 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
#4 5.299 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: temporary error (try again later)
#4 10.30 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: temporary error (try again later)
#4 10.30 ERROR: unable to select packages:
#4 10.30   mysql-client (no such package):
#4 10.30     required by: world[mysql-client]
------
executor failed running [/bin/sh -c apk add --no-cache mysql-client]: exit code: 1

Issue was with docker desktop I suppose. I uninstall docker desktop and did the docker install directly in wsl did few changes to the network-host and it worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM