错误一
docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
解决 docker build -t order . (结尾有一个点)
错误二
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=2dsejav1qs1af91h7cpcg76g0&shmsize=0&t=order&target=&ulimits=null&version=1": dial unix /var/run/docker.sock: connect: permission denied
解决方法 找不到文件
sudo groupadd docker #添加docker用户组
sudo gpasswd -a $XXX docker #检测当前用户是否已经在docker用户组中,其中XXX为用户名。
sudo gpasswd -a $USER docker #将当前用户添加至docker用户组
newgrp docker #更新docker用户组
错误三
/aspnet:8-buster-slim not found: manifest unknown: manifest tagged by "8-buster-slim" is not found
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order .
Sending build context to Docker daemon 28.15MB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:8-buster-slim AS base
manifest for mcr.microsoft.com/dotnet/core/aspnet:8-buster-slim not found: manifest unknown: manifest tagged by "8-buster-slim" is not found
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order .
Sending build context to Docker daemon 28.15MB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:8.0-buster-slim AS base
manifest for mcr.microsoft.com/dotnet/core/aspnet:8.0-buster-slim not found: manifest unknown: manifest tagged by "8.0-buster-slim" is not found
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ ^C
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order .
Sending build context to Docker daemon 28.15MB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:8.0- AS base
manifest for mcr.microsoft.com/dotnet/core/aspnet:8.0- not found: manifest unknown: manifest tagged by "8.0-" is not found
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order .
Sending build context to Docker daemon 28.15MB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:8.0 AS base
manifest for mcr.microsoft.com/dotnet/core/aspnet:8.0 not found: manifest unknown: manifest tagged by "8.0" is not found
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order .
Sending build context to Docker daemon 28.15MB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:8.0.0 AS base
manifest for mcr.microsoft.com/dotnet/core/aspnet:8.0.0 not found: manifest unknown: manifest tagged by "8.0.0" is not found
guhaifeiyan@guhaifeiyan-PC:/data/home/guhaifeiyan/Project/Order.API$ docker build -t order .
Sending build context to Docker daemon 28.15MB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:8.0.0-windowsservercore-ltsc2022 AS base
manifest for mcr.microsoft.com/dotnet/core/aspnet:8.0.0-windowsservercore-ltsc2022 not found: manifest unknown: manifest tagged by "8.0.0-windowsservercore-ltsc2022"
解决方法 就是更改DockerFile 里的地址
到这个地址里面找
microsoft-dotnet-sdk - Official Image | Docker Hub
ROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
#mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
EXPOSE 80
#-buster
FROM mcr.microsoft.com/dotnet/core/sdk:8.0 AS build
错误四
COPY failed: stat /var/lib/docker/tmp/docker-builder239868573/Order.API/Order.API.csproj: no such file or directory
解决方法
sudo chmod -R 777 /var/lib/docker/
问题五
Step 6/16 : COPY ["Order.API/Order.API.csproj", "Order.API/"]
COPY failed: stat /var/lib/docker/tmp/docker-builder470893402/Order.API/Order.API.csproj: no such file or directory
解决方法
1 COPY ["./*.csproj", "./"] //注意路径就行
2 COPY ["./Order.API.csproj", "Order.API/"]
问题六
在 docker 中使用这些文件,运行报错,检查文件才行
问题七
Docker 启动后 不能访问
解决访问
映射到80 不能行,更改后ok
使用 vi /etc/sysctl.conf
# 解除 net.ipv4.ip_forward = 1 的注释
然后重启服务,命令:
systemclt restart NetworkManager.service
systemctl restart docker.service
问题八
ERROR: failed to solve: mcr.microsoft.com/dotnet/sdk:8.0: failed to do request: Head "https://mcr.microsoft.com/v2/dotnet/sdk/manifests/8.0": dial tcp: lookup mcr.microsoft.com on 127.0.0.53:53: server misbehaving
此处更换其他dockerfile解决
标签:8.0,guhaifeiyan,错误,microsoft,manifest,build,解决,Docker,docker From: https://www.cnblogs.com/liujian1368928/p/17995367