After some minutes disk will be full

I have 3 image one of docker hub and I wrote two images.
After some minutes my disk will be full.
If I use ‘docker rm -f’ I can free myu disk.
Why docker try to increment its size? How can I tell to docker don’t increase?

Please provide context informations: docker info, os, disk size of blockdevice mounted in /var/lib/docker or whatever your docker data-root folder is, details about where the growth happens.

There is huge different if your blockdevice has 2G, 20G or 200G. If possible use a different blockdevice or at least partition for /var/lib/docker so that if it fills up your root filesytem still has space to work with.

Docker doesn’t care and certainly doesn’t try. Metin is right, we need more information but my experience is that people sometimes doesn’t notice that their containers are constantly recreated by some external service. If the container has anonymous volumes, it creates a new volume every time so depending on the size of the volume, you can use a lot of space in a very short time. An other reason was in the past that the user tried to build the Docker image so many times that Docker created a lot of unused layers (“dangling” images). If you have a huge layer which contains a 1 gigabyte installation and you change one character in the RUN instruction or COPY a new file/folder, you can use a lot of space again.

Is it the whole command or you delete a specific container? If the size of a container is what became large, then you have a process inside the container which writes the container filesystem in a wrong way or you edit a huge file which is not on the writable container filesystem but on a readonly image layer (less likely I think).

You should investigate what your container actually does, but again, the questions that Metin asked could be important too.

My Docerfile is:

FROM python:3.7.5-slim

COPY ./debs /debdir
COPY sources.list /etc/apt/
RUN apt-get update
RUN apt-get install libgssapi-krb5-2 -y
RUN dpkg -i  /debdir/libicu63_63.1-6+deb10u3_amd64.deb
RUN dpkg -i  /debdir/powershell-lts_7.2.1-1.deb_amd64.deb
RUN mkdir -p /root/.local/share/powershell/

COPY ./ubuntu.ova
COPY ./powershell /root/.local/share/powershell/ 
COPY ./installer.ps1 /
COPY ./uninstaller.ps1 /

COPY ./ /
RUN chmod +x /

And is:

usr/bin/pwsh-lts /installer.ps1
cleanup() {
    echo "Container stopped, performing cleanup..."
    nohup /usr/bin/pwsh-lts /uninstaller.ps1 &
trap  'cleanup' 15
while true
        echo "waiting for signal"

Also I attached docker container inspect ID output is:

        "Id": "4173daec45ee501fd34064ef5e791568252c16d2329b229afd0553b35d0dfc15",
        "Created": "2022-05-08T21:39:36.387769556Z",
        "Path": "/",
        "Args": [],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 137,
            "Error": "",
            "StartedAt": "2022-05-08T21:39:36.873414717Z",
            "FinishedAt": "2022-05-08T21:50:11.125837904Z"
        "Image": "sha256:ddefc8019fd382bb07b1cd67728dc08e480266d6afdde785c428058f91b23817",
        "ResolvConfPath": "/var/lib/docker/containers/4173daec45ee501fd34064ef5e791568252c16d2329b229afd0553b35d0dfc15/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/4173daec45ee501fd34064ef5e791568252c16d2329b229afd0553b35d0dfc15/hostname",
        "HostsPath": "/var/lib/docker/containers/4173daec45ee501fd34064ef5e791568252c16d2329b229afd0553b35d0dfc15/hosts",
        "LogPath": "/var/lib/docker/containers/4173daec45ee501fd34064ef5e791568252c16d2329b229afd0553b35d0dfc15/4173daec45ee501fd34064ef5e791568252c16d2329b229afd0553b35d0dfc15-json.log",
        "Name": "/upbeat_lederberg",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            "NetworkMode": "default",
            "PortBindings": null,
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "host",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
            "ReadonlyPaths": [
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/98286b21281c41e694cd21ae991c7dcc680ab739666fa06185396ae058cab73b-init/diff:/var/lib/docker/overlay2/65c1f9c324f5a133c5201c19131e89e0d4036023386858b53f762770dacd38e9/diff:/var/lib/docker/overlay2/530ff720d0133f7b95b61c30a3356a2c9e482cda2dce8891e085c3d0b0094144/diff:/var/lib/docker/overlay2/2ca0a6ca5d34b07d248879fd6513c714b5b21daf3c788ff4aacd0b6f2d197735/diff:/var/lib/docker/overlay2/3d50fa7c52cd64a2e2854fa923149514d75cce2b2279a2aa9f35eeccaa98a4af/diff:/var/lib/docker/overlay2/2db678316835cc84a811db372538d837e506937cb734e76fd1dfda09d472b67a/diff:/var/lib/docker/overlay2/e77053fa7a1ea3579b329e19309eaaeeca67a83b0718b7d39508ee6e6ecb608c/diff:/var/lib/docker/overlay2/1e935af263b50783e677d0c7f9a8b8ee07da83789e0596db9279b919e94f1ce5/diff:/var/lib/docker/overlay2/bd8d1242bc3159eaa08a64b64e6459c515b9077f22183ef6ee6645255a918443/diff:/var/lib/docker/overlay2/ecde37dfa81adfda06163052c648e6ecf1f467baa4591909d3fcf68bfde080bd/diff:/var/lib/docker/overlay2/152d447d2fbeaa0714f2d2aa3ae37f55f96c934063971934ef4188de6ae04880/diff:/var/lib/docker/overlay2/36e487163a38eaaa8e4af44e1499151bfaf8320f991b2f4d3a9ecbc438fe5532/diff:/var/lib/docker/overlay2/684d04375d6d0e1216b28c6c4bd258c4c2603be4d9b82060f541fb1cbf3dfc08/diff:/var/lib/docker/overlay2/323eed9424347a23aef28d9f5d5c09fc35a5deff184bb5079311474c5a5503c3/diff:/var/lib/docker/overlay2/9ff17a6265e7a96484c3d930bda9b255636cc83d356cf4a29d05d524fbbc2ab9/diff",
                "MergedDir": "/var/lib/docker/overlay2/98286b21281c41e694cd21ae991c7dcc680ab739666fa06185396ae058cab73b/merged",
                "UpperDir": "/var/lib/docker/overlay2/98286b21281c41e694cd21ae991c7dcc680ab739666fa06185396ae058cab73b/diff",
                "WorkDir": "/var/lib/docker/overlay2/98286b21281c41e694cd21ae991c7dcc680ab739666fa06185396ae058cab73b/work"
            "Name": "overlay2"
        "Mounts": [],
        "Config": {
            "Hostname": "4173daec45ee",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "ENVIRONMENT_CONTEXT={\"variables\": {\"vcenter_server\": \"\", \"vcenter_username\": \"administrator@vsphere.local\", \"vcenter_password\": \"P@ssw0rd\"}, \"resources\": []}",
            "Cmd": null,
            "Image": "sha256:ddefc8019fd382bb07b1cd67728dc08e480266d6afdde785c428058f91b23817",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
            "OnBuild": null,
            "Labels": {}
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "2903663c109b1d23666d6d9e0ec5b77b4f2fa7f4ff6dd175d2bf1f5fd762a345",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/2903663c109b",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "966783b1bb50cfdccef66b2cd7be3e7ff88067e6cd73560ac82a26e8630742bf",
                    "EndpointID": "",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null

Please consider the details that someone, who doesn’t have your knowledge about your context, might need to fully understand your situation.

We still know nothing about your os, the docker version, the harddisk size available for the docker root- data folder, the image size. Even the pasted Dockerfile is worth nothing without further explaination. as it could do everything or nothing.

Though, what immediatly meets the eye are that a ova file is copied inside an image - it could be a couple of houndred megabytes or even gigabytes in size.

Also are you sure the “installer.ps1” or a process it calls does not extract the ova file during processing? If it does it would be unarchived into the containers filesytem, which of course occupies space immediatly. Also stopped, but not remove containers still occupy space.

I am not going to ask why you choose to use a container image to transport an ova vm template and import it into a vsphere environment. If a solution architect would suggest such a solution to me, I would challenge her/him about why this approach was choosen.

I removed echo line and it was solved.

I didn’t notice that infinite loop with that echo. Everything, that you write to the standard output goes to the log file. If you use echo or anything with output, make sure, you use some delay between the echos.

Now I understand why docker rm solved the problem. It deleted the logs too.

Good that you managed to find it :clap: