我在 Windows 10 pro 上更新了桌面应用程序的 docker(版本 2.0.0.3)。但从那时起,我的 docker 无法启动并抛出以下错误。
Hyper-V\Get-VMNetworkAdapter : Hyper-V was unable to find a virtual switch with name "DockerNAT".
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:121 char:25
+ ... etAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (DockerNAT:String) [Get-VMNetworkAdapter], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVMNetworkAdapter
Run Code Online (Sandbox Code Playgroud)
我按照链接中提到的步骤进行操作(手动删除 Hyper-V 中的 MobyLinuxVM 后,Windows 10 上的 Docker 无法启动),但没有解决问题。
我还尝试禁用 --> 重新启动 --> 然后使用“控制面板\程序\程序和功能”中的“打开或关闭 Windows 功能”启用 Hyper V 和容器选项
但我仍然无法启动我的 Windows Docker 应用程序,它不断抛出异常
Hyper-V was unable to find a …Run Code Online (Sandbox Code Playgroud) 我们有一些本地安装程序和 zip 文件,用于构建 docker 映像。让它在 Dockerfile 中工作很容易:
FROM mcr.microsoft.com/windows/nanoserver
COPY myinstaller.exe .
RUN myinstaller.exe; \
del myinstaller.exe
Run Code Online (Sandbox Code Playgroud)
这里的问题是它为 COPY 线生成了一个图层,这增加了图像的大小。一种常见的解决方法是使用一个 RUN 行,从 Internet 下载文件,运行命令,然后删除安装文件。如上所述,问题在于安装程序位于本地文件系统上。
我发现docker有一个--squash命令:
docker build --squash -t mytestimage .
Run Code Online (Sandbox Code Playgroud)
这正是我想要的:它为我提供了一个图像,而没有这个不必要的额外安装程序文件。要运行此命令,您需要启用实验性功能。还有一个悬而未决的问题可以简单地删除此功能:
https://github.com/moby/moby/issues/34565
在 Windows 上运行时,是否有其他方法可以在 Dockerfile 中使用本地安装程序,而不涉及设置服务器来提供文件?
我正在使用 Windows 版 docker,我注意到我的 C 驱动器已满。当我查看时,我注意到这里有 15 GB 的数据:Docker/windowsfilter。我偶尔使用 docker,因此不需要保留任何图像或容器。
所以我用谷歌搜索了一些并尝试了类似docker system prune docker image prune容器等的建议。
这似乎不起作用,我找不到另一个合适的解决方案,所以最后我尝试了一个经常提到的工具docker-ci-zap,但这里也没有运气
最后我尝试了 docker 本身的出厂重置,据我了解应该删除所有内容。
但Docker/windowsfilter仍然是 15 GB。我怎样才能摆脱这些数据?
我有一个 keras 模型(Windows Spyder IDE)并保存用于张量流服务,并按照https://www.youtube.com/watch?v=CUpUPY5g8NE中的步骤进行部署。
我正在使用 docker-for-windows 并运行 Windows 容器(因此 docker 中没有共享驱动器设置)
我拉了 TF 服务并使用参数运行 docker
> docker pull tensorflow/serving
> docker run -t --rm -d -p 8500:8500 -p 8501:8501 --name tf_model --mount type=bind,source=$LOCALMODELDIR/tf_model,target=/models/mymodel --mount type=bind,source=$LOCALMODELDIR/models.config,target=/models/models.config -e MODEL_NAME=mymodel tensorflow/serving --model_config_file=/models/models.config
Run Code Online (Sandbox Code Playgroud)
我跑到 docker 中的错误为
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid mount config for type "bind": source path must be a directory.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
Run Code Online (Sandbox Code Playgroud)
我可以知道任何修复吗?
我想挂载 cifs / smb 共享以在容器内进行读写使用。我尝试了一切直接从正在运行的容器安装它,但是所有解决所有 Docker 安全问题的方法(--privileged、SYSADMIN 等)a)都不起作用,b)似乎都不是合理的事情要做。因此,我决定为 cifs 共享创建一个 docker 卷,并将其安装在运行容器上。我这样创建卷:
docker volume create \
--driver local \
--opt type=cifs \
--opt o=addr=ip \
--opt device=//ip/data-root \
--opt o=username==xxx,password=xxx,file_mode=0770,dir_mode=0770 \
--name volz
Run Code Online (Sandbox Code Playgroud)
像这样运行容器docker run -it --rm --name nuke -v volz:/mnt/z nuke:12.0v2
会导致
\docker.exe:来自守护程序的错误响应:无法安装本地卷:安装(...)权限被拒绝。
添加,iocharset=utf8,vers=3.0,sec=ntlmssp也没有帮助。dockers -v 挂载是在容器中以 root 身份执行还是以容器启动的用户身份执行?
更新:将卷安装到新的 centos 容器会导致相同的错误。
我尝试在 Windows 10 企业版上安装 Docker,但出现以下异常。
安装失败
The Server service is not started.
at System.DirectoryServices.DirectoryEntry.RefreshCache()
at System.DirectoryServices.AccountManagement.PrincipalContext.DoMachineInit()
at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()
at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)
at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue)
at System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext context, String identityValue)
at CommunityInstaller.CreateGroupAction.<DoAsync>b__33_0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CommunityInstaller.InstallWorkflow.<HandleD4WPackageAsync>d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown --- …Run Code Online (Sandbox Code Playgroud) 当尝试构建基于 ubuntu 的 Docker 容器(Docker for Windows)时,突然出现类似于以下内容的错误
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 9h 55min 59s). Updates for this repository will not be applied.
Run Code Online (Sandbox Code Playgroud)
并且构建失败。我怎样才能解决这个问题?
使用 docker 和 wsl2 构建我的容器,我想看看会发生什么。在 wsl 中运行htop仅显示 CPU 使用情况,但我的容器中没有运行任何进程。
搜索htop、docker和的唯一信息wsl2,我唯一能找到的是这个存档且不相关的 reddit-thread:https://www.reddit.com/r/bashonubuntuonwindows/comments/dia2bw/htop_on_wsl2_doesnt_show_any_processes_while_ps/
使用适用于 Windows 10 pro Hyper-V 的 Docker,我可以正常使用文件共享。因此,在 Docker 桌面资源部分中,我添加了一个类似于K:\dataWindows 主机上的文件夹。这对我来说很有效,很多年了。
所以我当前的配置是:
K:\data我研究是否可以切换到 Docker for Windows WSL2。然后我想继续将 docker compose 文件与 2 个 Docker 容器一起使用。我想继续使用驻留在 Windows 主机上的数据。更具体地说,在K:\data.
是否可以从带有 Hyper-V 的 Docker for Windows 切换到 Docker for Windows WSL2,并且仍然使用驻留在 Windows 文件夹中的现有数据?
这不是重复的问题:我使用 Docker compose,所以我不想使用“docker run -v 'host'”解决方案。在我的 docker compose 文件中,我使用以下行:
volumes:
- //k/data/spring-boot-app:/data/spring-boot-app …Run Code Online (Sandbox Code Playgroud) 我的目的是使用 Windows Docker 部署 InfluxDB 2.0.8 数据库,并通过同一 Docker 网络上的自托管 Grafana 实例链接到它。
\n为此,我已完成以下步骤:
\ndocker network create influxdb\ndocker run -d --net=influxdb --name=grafana -p 3000:3000 grafana/grafana\ndocker run -d --net=influxdb --name=influxdb -p 8086:8086 --volume C:/influxdb:/var/lib/influxdb2 influxdb:2.0.8\nRun Code Online (Sandbox Code Playgroud)\nPOST http://localhost:3000/api/ds/query 400 (Bad Request)\n{refId: …Run Code Online (Sandbox Code Playgroud) docker ×8
dockerfile ×1
grafana ×1
influxdb ×1
installation ×1
tensorflow ×1
ubuntu ×1
windows ×1
wsl-2 ×1