title: docker container tmp folder full
body: <p>I can't npm install because <code>npm WARN tar ENOSPC: no space left on device, write</code> inside docker container. I check the space of my <code>/tmp</code> folder using <code>df -h /tmp</code>. 99% used, I add a remove tmp folder command but doesn't work. </p>
  
  <p><strong>Inside container</strong></p>
  
  <pre><code>Filesystem                Size      Used Available Use% Mounted on
  overlay                  24.1G     23.9G    181.2M  99% /
  </code></pre>
  
  <p><strong>/var/lib/docker Usages df-h</strong></p>
  
  <pre><code>Filesystem      Size  Used Avail Use% Mounted on
  udev            991M     0  991M   0% /dev
  tmpfs           201M   22M  179M  11% /run
  /dev/vda1        49G  6.8G   42G  14% /
  tmpfs          1001M     0 1001M   0% /dev/shm
  tmpfs           5.0M     0  5.0M   0% /run/lock
  tmpfs          1001M     0 1001M   0% /sys/fs/cgroup
  /dev/vda15      105M  3.6M  101M   4% /boot/efi
  tmpfs           201M     0  201M   0% /run/user/0
  overlay          49G  6.8G   42G  14% /home/docker/overlay2/6e1df9a8f52cb302f46272340fa647c14d60a0bfc261f3e9629ffede92de5898/merged
  overlay          49G  6.8G   42G  14% /home/docker/overlay2/dcc995f1e015688463de51704f35874683a29a1f2e2478bc9192ec8fd53042e9/merged
  shm              64M     0   64M   0% /home/docker/containers/d72785d20ee62d6db718be7644197d60ce7e4cdf1341eb7945a25a37b21f9172/mounts/shm
  shm              64M     0   64M   0% /home/docker/containers/7b3b892baa4a85bd04e7aa23b0f1d561d483ea6010f96dbd52a6af727582a063/mounts/shm
  overlay          49G  6.8G   42G  14% /home/docker/overlay2/bf7a4c992a584065b37c5d2598ec6339a98c16c7aba22e405ec1d404e1da8e6d/merged
  shm              64M     0   64M   0% /home/docker/containers/6356136081e544631fc97471754a119c9b769162f73314287c4cbb20e1ce8d62/mounts/shm
  overlay          49G  6.8G   42G  14% /home/docker/overlay2/f905b2e51f815a7d2385e2eafcbbecca7881ba7fbffbf829927164c2c088dc00/merged
  shm              64M     0   64M   0% /home/docker/containers/991b04b7ff7a6532ba4b82d443022bea0cefa3d37c82c780bae6a7ad51914ed8/mounts/shm
  overlay          49G  6.8G   42G  14% /home/docker/overlay2/7682c5490149bdca59c5b8a2118fe11e4e9cdf8d0c175e86784483ffdf3351c7/merged
  shm              64M     0   64M   0% /home/docker/containers/00074204f86855f224d7058041e0785546daf9d3e09cb4f44b95661c3e4469e4/mounts/shm
  overlay          49G  6.8G   42G  14% /home/docker/overlay2/22376e843826d4be505868904dbd0dcc477b4997a96cc2debd40ac2073049c60/merged
  shm              64M     0   64M   0% /home/docker/containers/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3/mounts/shm
  </code></pre>
  
  <p><strong>/var/lib/docker Usages df-ih</strong></p>
  
  <pre><code>Filesystem     Inodes IUsed IFree IUse% Mounted on
  udev             248K   384  248K    1% /dev
  tmpfs            251K   697  250K    1% /run
  /dev/vda1        6.2M  345K  5.9M    6% /
  tmpfs            251K     1  251K    1% /dev/shm
  tmpfs            251K     6  251K    1% /run/lock
  tmpfs            251K    16  250K    1% /sys/fs/cgroup
  /dev/vda15          0     0     0     - /boot/efi
  tmpfs            251K     4  251K    1% /run/user/0
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/6e1df9a8f52cb302f46272340fa647c14d60a0bfc261f3e9629ffede92de5898/merged
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/dcc995f1e015688463de51704f35874683a29a1f2e2478bc9192ec8fd53042e9/merged
  shm              251K     1  251K    1% /home/docker/containers/d72785d20ee62d6db718be7644197d60ce7e4cdf1341eb7945a25a37b21f9172/mounts/shm
  shm              251K     1  251K    1% /home/docker/containers/7b3b892baa4a85bd04e7aa23b0f1d561d483ea6010f96dbd52a6af727582a063/mounts/shm
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/bf7a4c992a584065b37c5d2598ec6339a98c16c7aba22e405ec1d404e1da8e6d/merged
  shm              251K     1  251K    1% /home/docker/containers/6356136081e544631fc97471754a119c9b769162f73314287c4cbb20e1ce8d62/mounts/shm
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/f905b2e51f815a7d2385e2eafcbbecca7881ba7fbffbf829927164c2c088dc00/merged
  shm              251K     1  251K    1% /home/docker/containers/991b04b7ff7a6532ba4b82d443022bea0cefa3d37c82c780bae6a7ad51914ed8/mounts/shm
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/7682c5490149bdca59c5b8a2118fe11e4e9cdf8d0c175e86784483ffdf3351c7/merged
  shm              251K     1  251K    1% /home/docker/containers/00074204f86855f224d7058041e0785546daf9d3e09cb4f44b95661c3e4469e4/mounts/shm
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/22376e843826d4be505868904dbd0dcc477b4997a96cc2debd40ac2073049c60/merged
  shm              251K     1  251K    1% /home/docker/containers/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3/mounts/shm
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/e7bad84d978976233216308e10fc600c1b7956d8991060f792871823d0350cba/merged
  shm              251K     1  251K    1% /home/docker/containers/71f23bf09ce2bf44ca76b568850308a655f5b5e981a1c4dc4820e03e7edee773/mounts/shm
  overlay          6.2M  345K  5.9M    6% /home/docker/overlay2/920f3dc9f832dcde427a827737b8aab355b6839c59cef8e592b31dcba1e4be61/merged
  shm              251K     1  251K    1% /home/docker/containers/b422e8cabf6112ce860ed924f820ed1940273d93e96a37b4ea775d74540a2cb1/mounts/shm
  </code></pre>
  
  <p><strong>Docker Info</strong></p>
  
  <pre><code>Containers: 8
   Running: 8
   Paused: 0
   Stopped: 0
  Images: 7
  Server Version: 18.09.3
  Storage Driver: overlay2
   Backing Filesystem: extfs
   Supports d_type: true
   Native Overlay Diff: true
  Logging Driver: json-file
  Cgroup Driver: cgroupfs
  Plugins:
   Volume: local
   Network: bridge host macvlan null overlay
   Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
  Swarm: inactive
  Runtimes: runc
  Default Runtime: runc
  Init Binary: docker-init
  containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
  runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
  init version: fec3683
  Security Options:
   apparmor
   seccomp
    Profile: default
  Kernel Version: 4.4.0-143-generic
  Operating System: Ubuntu 16.04.6 LTS
  OSType: linux
  Architecture: x86_64
  CPUs: 1
  Total Memory: 1.953GiB
  Name: {Server-name}
  ID: 3ST7:BBF2:SARX:YZP6:ZREZ:Z7BK:5IYV:AJ6Z:2NTG:3F2R:EYKP:ETWK
  Docker Root Dir: /home/docker
  Debug Mode (client): false
  Debug Mode (server): false
  Registry: https://index.docker.io/v1/
  Labels:
  Experimental: false
  Insecure Registries:
   127.0.0.0/8
  Live Restore Enabled: false
  Product License: Community Engine
  </code></pre>
  
  <p><strong>Docker Inspect</strong></p>
  
  <pre><code>[
      {
          "Id": "e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3",
          "Created": "2019-04-09T03:25:48.571426107Z",
          "Path": "npm",
          "Args": [
              "start"
          ],
          "State": {
              "Status": "running",
              "Running": true,
              "Paused": false,
              "Restarting": false,
              "OOMKilled": false,
              "Dead": false,
              "Pid": 473,
              "ExitCode": 0,
              "Error": "",
              "StartedAt": "2019-04-09T03:25:49.493986988Z",
              "FinishedAt": "0001-01-01T00:00:00Z"
          },
          "Image": "sha256:6bfd6eba3a8c669caa7531592c5b01d6d1f24f6de30d3f0f6133ab932f9fa1b4",
          "ResolvConfPath": "/home/docker/containers/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3/resolv.conf",
          "HostnamePath": "/home/docker/containers/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3/hostname",
          "HostsPath": "/home/docker/containers/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3/hosts",
          "LogPath": "/home/docker/containers/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3/e0e75a420e3126645734ea55bddeccff8c5b4c95fcaaa326b96a765dee88f8b3-json.log",
          "Name": "/appServer",
          "RestartCount": 0,
          "Driver": "overlay2",
          "Platform": "linux",
          "MountLabel": "",
          "ProcessLabel": "",
          "AppArmorProfile": "docker-default",
          "ExecIDs": null,
          "HostConfig": {
              "Binds": null,
              "ContainerIDFile": "",
              "LogConfig": {
                  "Type": "json-file",
                  "Config": {}
              },
              "NetworkMode": "traefik_proxy",
              "PortBindings": {
                  "8889/tcp": [
                      {
                          "HostIp": "",
                          "HostPort": "8889"
                      }
                  ]
              },
              "RestartPolicy": {
                  "Name": "unless-stopped",
                  "MaximumRetryCount": 0
              },
              "AutoRemove": false,
              "VolumeDriver": "",
              "VolumesFrom": null,
              "CapAdd": null,
              "CapDrop": null,
              "Dns": [],
              "DnsOptions": [],
              "DnsSearch": [],
              "ExtraHosts": null,
              "GroupAdd": null,
              "IpcMode": "shareable",
              "Cgroup": "",
              "Links": null,
              "OomScoreAdj": 0,
              "PidMode": "",
              "Privileged": false,
              "PublishAllPorts": false,
              "ReadonlyRootfs": false,
              "SecurityOpt": null,
              "UTSMode": "",
              "UsernsMode": "",
              "ShmSize": 67108864,
              "Runtime": "runc",
              "ConsoleSize": [
                  0,
                  0
              ],
              "Isolation": "",
              "CpuShares": 0,
              "Memory": 0,
              "NanoCpus": 0,
              "CgroupParent": "",
              "BlkioWeight": 0,
              "BlkioWeightDevice": [],
              "BlkioDeviceReadBps": null,
              "BlkioDeviceWriteBps": null,
              "BlkioDeviceReadIOps": null,
              "BlkioDeviceWriteIOps": null,
              "CpuPeriod": 0,
              "CpuQuota": 0,
              "CpuRealtimePeriod": 0,
              "CpuRealtimeRuntime": 0,
              "CpusetCpus": "",
              "CpusetMems": "",
              "Devices": [],
              "DeviceCgroupRules": null,
              "DiskQuota": 0,
              "KernelMemory": 0,
              "MemoryReservation": 0,
              "MemorySwap": 0,
              "MemorySwappiness": null,
              "OomKillDisable": false,
              "PidsLimit": 0,
              "Ulimits": null,
              "CpuCount": 0,
              "CpuPercent": 0,
              "IOMaximumIOps": 0,
              "IOMaximumBandwidth": 0,
              "MaskedPaths": [
                  "/proc/asound",
                  "/proc/acpi",
                  "/proc/kcore",
                  "/proc/keys",
                  "/proc/latency_stats",
                  "/proc/timer_list",
                  "/proc/timer_stats",
                  "/proc/sched_debug",
                  "/proc/scsi",
                  "/sys/firmware"
              ],
              "ReadonlyPaths": [
                  "/proc/bus",
                  "/proc/fs",
                  "/proc/irq",
                  "/proc/sys",
                  "/proc/sysrq-trigger"
              ]
          },
          "GraphDriver": {
              "Data": {
                  "LowerDir": "/home/docker/overlay2/22376e843826d4be505868904dbd0dcc477b4997a96cc2debd40ac2073049c60-init/diff:/home/docker/overlay2/a50a2534da040e431c25cc08ed28dd8488d40b291db975e8c03aa56e7c523ccc/diff:/home/docker/overlay2/025c625fedfabedfb9217a15aa71e2e6ae221915d2bbcf9c77c2c94d8e799ba9/diff:/home/docker/overlay2/84844b839da1e829877a26b9a5921e6fe2bc118cc27348b64bb0b8d02462e8cc/diff:/home/docker/overlay2/4ff909483d30be4c779579516d8dff39f8123e7e6114871f71cc7eaa69b953b1/diff:/home/docker/overlay2/fb7de39793554b2fbfa00b48e7851c5b003e2d40ef26fa959f2ba6ab27ac9421/diff",
                  "MergedDir": "/home/docker/overlay2/22376e843826d4be505868904dbd0dcc477b4997a96cc2debd40ac2073049c60/merged",
                  "UpperDir": "/home/docker/overlay2/22376e843826d4be505868904dbd0dcc477b4997a96cc2debd40ac2073049c60/diff",
                  "WorkDir": "/home/docker/overlay2/22376e843826d4be505868904dbd0dcc477b4997a96cc2debd40ac2073049c60/work"
              },
              "Name": "overlay2"
          },
          "Mounts": [],
          "Config": {
              "Hostname": "e0e75a420e31",
              "Domainname": "",
              "User": "",
              "AttachStdin": false,
              "AttachStdout": false,
              "AttachStderr": false,
              "ExposedPorts": {
                  "8889/tcp": {}
              },
              "Tty": false,
              "OpenStdin": false,
              "StdinOnce": false,
              "Env": [
                  "NODE_ENV=production",
                  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                  "NODE_VERSION=10.15.3",
                  "YARN_VERSION=1.13.0"
              ],
              "Cmd": [
                  "npm",
                  "start"
              ],
              "ArgsEscaped": true,
              "Image": "cloud.canister.io:5000/randomUser/appServer:94ed04b",
              "Volumes": null,
              "WorkingDir": "/app",
              "Entrypoint": null,
              "OnBuild": null,
              "Labels": {
                  "traefik.backend": "appServer",
                  "traefik.docker.network": "traefik_proxy",
                  "traefik.enable": "true",
                  "traefik.frontend.headers.SSLHost": "website.com",
                  "traefik.frontend.headers.SSLRedirect": "true",
                  "traefik.frontend.headers.STSIncludeSubdomains": "true",
                  "traefik.frontend.headers.STSPreload": "true",
                  "traefik.frontend.headers.STSSeconds": "315360000",
                  "traefik.frontend.headers.browserXSSFilter": "true",
                  "traefik.frontend.headers.contentTypeNosniff": "true",
                  "traefik.frontend.headers.forceSTSHeader": "true",
                  "traefik.frontend.headers.frameDeny": "true",
                  "traefik.frontend.rule": "Host:website.com",
                  "traefik.port": "8889"
              }
          },
          "NetworkSettings": {
              "Bridge": "",
              "SandboxID": "00510757a3eb7cd8ca00c41169a72cae55c46b7608a71961062356cf81840a2a",
              "HairpinMode": false,
              "LinkLocalIPv6Address": "",
              "LinkLocalIPv6PrefixLen": 0,
              "Ports": {
                  "8889/tcp": [
                      {
                          "HostIp": "0.0.0.0",
                          "HostPort": "8889"
                      }
                  ]
              },
              "SandboxKey": "/var/run/docker/netns/00510757a3eb",
              "SecondaryIPAddresses": null,
              "SecondaryIPv6Addresses": null,
              "EndpointID": "",
              "Gateway": "",
              "GlobalIPv6Address": "",
              "GlobalIPv6PrefixLen": 0,
              "IPAddress": "",
              "IPPrefixLen": 0,
              "IPv6Gateway": "",
              "MacAddress": "",
              "Networks": {
                  "traefik_proxy": {
                      "IPAMConfig": null,
                      "Links": null,
                      "Aliases": [
                          "e0e75a420e31"
                      ],
                      "NetworkID": "950d61fcc027e81f4681236726300b3e178af808e4e49260a967971f67af9518",
                      "EndpointID": "7093732ece6ceab22f18810812a1e6eefc9fb22d244a4c88cdb78edd34f5e8ab",
                      "Gateway": "172.18.0.1",
                      "IPAddress": "172.18.0.4",
                      "IPPrefixLen": 16,
                      "IPv6Gateway": "",
                      "GlobalIPv6Address": "",
                      "GlobalIPv6PrefixLen": 0,
                      "MacAddress": "02:42:ac:12:00:04",
                      "DriverOpts": null
                  }
              }
          }
      }
  ]
  </code></pre>
  
  <p>How to remove <code>/tmp</code> inside container? Is it safe to clear overlay folder in docker?</p>