openfaas / faasd

A lightweight & portable faas engine
https://store.openfaas.com/l/serverless-for-everyone-else
MIT License
2.97k stars 213 forks source link

Support request for Docker installed with faasd (invalid) #331

Closed ikhyunAn closed 12 months ago

ikhyunAn commented 1 year ago

Why do you need this?

I cannot deploy functions anymore due to disk space running out, which I assume occurs from "snapshots" taking up space

Who is this for?

School research

Expected Behaviour

Although I have deleted all faasd functions and docker images, my function wouldn't deploy due to disk space running out. I tried to run these commands

sudo ctr --namespace openfaas-fn task delete -f $FN
sudo ctr --namespace openfaas-fn container delete $FN
sudo ctr --namespace openfaas-fn snapshot remove $FN-snapshot

but instead of successfully removing them, I got error messages such as ERRO[0000] failed to load task from [function_name]

Current Behaviour

Whenever I deploy a function, I get the error message saying:

#22 33.66 ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device
#22 33.66
------
Dockerfile:39
--------------------
  37 |     COPY function/requirements.txt   .
  38 |
  39 | >>> RUN pip install -r requirements.txt --target=/home/app/python
  40 |
  41 |     WORKDIR /home/app/
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install -r requirements.txt --target=/home/app/python" did not complete successfully: exit code: 1

List All Possible Solutions and Workarounds

If there's way of removing unused snapshots / docker images / caches that would be great. If not, I suggest that when 'faas-cli remove [function_name]' is run all the snapshots etc. are removed as well.

Which Solution Do You Recommend?

Steps to Reproduce (for bugs)

Your Environment

go version

containerd -version

containerd github.com/containerd/containerd v1.7.0 1fbd70374134b891f97ce19c70b6e50c7b9f4e0d

uname -a

Linux ubuntu 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/os-release

PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

faasd version

faasd version: 0.16.9   commit: e1d90bba609a55ca123d26e5b7e1ccfcfedf3e8f
alexellis commented 1 year ago

Hey it looks like you may have mistakenly installed Docker on faasd VM? The output that you're sharing isn't from faasd but from Docker run.

Can you explain please?

And share df -h / along with lsblk

alexellis commented 1 year ago

/set title: Support request

ikhyunAn commented 1 year ago

The VM I'm using is a collaborative workspace, and the docker is installed on the VM on which faasd is also installed. I have the minio set up on the vm, the reason why docker is installed on the vm. I do see that it's recommended not to install the docker into the same host as faasd, but does the error message I'm seeing come from this problem?

I have uninstalled/deleted other packages and system files to free space, so the values on df -h are now lower than what they were. Before the /dev/vda usage was close to 100%.

df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           392M  976K  391M   1% /run
/dev/vda1        22G   14G  7.3G  66% /
tmpfs           2.0G  168K  2.0G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/vda15      105M  6.1M   99M   6% /boot/efi
tmpfs           392M   12K  392M   1% /run/user/1000
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0     7:0    0 116.8M  1 loop /snap/core/14946
loop1     7:1    0  63.3M  1 loop /snap/core20/1879
loop2     7:2    0  63.5M  1 loop /snap/core20/1891
loop3     7:3    0 111.9M  1 loop /snap/lxd/24322
loop4     7:4    0  53.2M  1 loop /snap/snapd/19122
loop5     7:5    0  53.3M  1 loop /snap/snapd/19361
loop6     7:6    0   4.2M  1 loop /snap/tree/18
sr0      11:0    1   366K  0 rom
vda     252:0    0    22G  0 disk
├─vda1  252:1    0  21.9G  0 part /
├─vda14 252:14   0     4M  0 part
└─vda15 252:15   0   106M  0 part /boot/efi
nitishkumar71 commented 1 year ago

faasd internal implementation already does the cleanup for task, snapshot and container, as implemented here.

alexellis commented 12 months ago

You cannot have docker installed on the same host as faasd, this is probably why you're running into problems.

BuildKit can be installed and used, with faas-cli shrinkwrap followed by docker build.

See also: https://docs.openfaas.com/cli/build/