首页 > 解决方案 > 如何扩大码头集装箱尺寸?

问题描述

我需要通过以下步骤创建一个大的 docker 镜像:

  1. 使用以下信息创建 Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.202-bionic as build
ARG BUILDCONFIG=RELEASE
ARG VERSION=1.0.0

WORKDIR .
COPY . /build/
COPY Model/Model.sln /build/Model/

RUN dotnet build ./build/Model/Model.sln
RUN dotnet restore ./build/Model/Model.sln

WORKDIR /build/Model
RUN dotnet publish Model.sln -c $BUILDCONFIG -o out /p:Version=$VERSION
  1. 使用以下命令构建 docker 镜像
$ docker build -t modelwithpr .
Sending build context to Docker daemon  27.39GB
Step 1/10 : FROM mcr.microsoft.com/dotnet/core/sdk:3.1.202-bionic as build
3.1.202-bionic: Pulling from dotnet/core/sdk
23884877105a: Pull complete 
bc38caa0f5b9: Pull complete 
2910811b6c42: Pull complete 
36505266dcc6: Pull complete 
21e3523d71cd: Pull complete 
3c423fdfc300: Pull complete 
3c953506ccad: Pull complete 
3b8b572de54f: Pull complete 
8f2eb870f86d: Pull complete 
e52b20b76b9c: Pull complete 
Digest: sha256:9ee35c3d8395a15b21cc2eca5d66c8e7df62254c12ddb1249731c568458de124
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:3.1.202-bionic
 ---> 82688290b31f
Step 2/10 : ARG BUILDCONFIG=RELEASE
 ---> Running in 74f348453403
Removing intermediate container 74f348453403
 ---> f07df710b48e
Step 3/10 : ARG VERSION=1.0.0
 ---> Running in d1556dc14108
Removing intermediate container d1556dc14108
 ---> 63b311ef2174
Step 4/10 : WORKDIR .
 ---> Running in acd6a2b9f467
Removing intermediate container acd6a2b9f467
 ---> cecc23485351
Step 5/10 : COPY . /build/
Error processing tar file(exit status 1): write /build/Model/bin/Debug/netcoreapp3.1/Microsoft.Data.SqlClient.dll: no space left on device

我检查了路径 Library/Containers/com.docker.docker/Data/vms/0/data 发现 Docker.raw 文件是 59GB(不知道为什么这么大)。

有没有办法扩大容器尺寸?

标签: imagedockerresize

解决方案


推荐阅读