hocus-dev / hocus

πŸͺ„ Spin up ready-to-code, disposable dev environments on your own servers. Self-hosted alternative to Gitpod and Github Codespaces.
https://hocus.dev
Other
3.18k stars 79 forks source link

Error during install: ops/bin/buildfs.sh: line 28: docker: command not found #111

Closed wilj closed 11 months ago

wilj commented 12 months ago

Error during install: ops/bin/buildfs.sh: line 28: docker: command not found

When I run the local-up.sh script I get an error that Docker cannot be found. It looks like Docker is missing in the agent image:

➜ hocus git:(main) HOCUS_HOSTNAME="localhost" ops/bin/local-up.sh

Building docker images πŸ‘·πŸ“¦
Building vm-builder done in 0.66 s βœ…
Building db-autosetup done in 0.70 s βœ…
Building keycloak done in 0.84 s βœ…
Building temporal-codec done in 1.50 s βœ…
Building ui done in 1.14 s βœ…
Building agent done in 1.12 s βœ…
Pulling docker images πŸ“₯ - βœ… in 2.37 s
Building MicroVMs πŸ‘·πŸ–₯️ - ❌ in 0.80
time="2023-07-08T11:16:45-10:00" level=warning msg="The \"AGENT_DEV_CREATE_HOCUS_PROJECTS\" variable is not set. Defaulting to a blank string."
time="2023-07-08T11:16:45-10:00" level=warning msg="The \"AGENT_DEV_CREATE_DEVELOPMENT_PROJECTS\" variable is not set. Defaulting to a blank string."
time="2023-07-08T11:16:45-10:00" level=warning msg="The \"HOCUS_REPO_PRIVATE_KEY\" variable is not set. Defaulting to a blank string."
time="2023-07-08T11:16:45-10:00" level=warning msg="The \"GITHUB_APP_HOCUS_DEV_CLIENT_SECRET\" variable is not set. Defaulting to a blank string."
+ mkdir -pv /agent_data/firecracker
+ mkdir -pv /agent_data/resources
+ ops/bin/buildfs.sh resources/docker/checkout-and-inspect.Dockerfile /agent_data/resources/checkout-and-inspect.ext4 resources/ 500
+ '[' -z resources/docker/checkout-and-inspect.Dockerfile ']'
+ '[' -z /agent_data/resources/checkout-and-inspect.ext4 ']'
+ '[' -z resources/ ']'
+ '[' -z 500 ']'
+ set -o nounset
++ realpath resources/docker/checkout-and-inspect.Dockerfile
+ DOCKERFILE_PATH=/build/resources/docker/checkout-and-inspect.Dockerfile
++ realpath /agent_data/resources/checkout-and-inspect.ext4
+ OUTPUT_PATH=/agent_data/resources/checkout-and-inspect.ext4
++ realpath resources/
+ CONTEXT_DIR=/build/resources
+ FS_MAX_SIZE_MIB=500
++ basename /build/resources/docker/checkout-and-inspect.Dockerfile
++ sed 's/\.Dockerfile//'
+ IMAGE_TAG=checkout-and-inspect
+ IMAGE_NAME=buildfs:checkout-and-inspect
++ cat /dev/urandom
++ tr -dc a-zA-Z0-9
++ head -c 8
++ true
+ CONTAINER_TAG=vzPUJNJ0
+ CONTAINER_NAME=container-buildfs-vzPUJNJ0
+ MOUNT_PATH=/tmp/buildfs-checkout-and-inspect
++ pwd
+ ORIGINAL_PATH=/build
+ docker build --progress=plain --tag buildfs:checkout-and-inspect --file /build/resources/docker/checkout-and-inspect.Dockerfile /build/resources
ops/bin/buildfs.sh: line 28: docker: command not found

Environment

Docker is installed on the host, but I see this error is coming from the agent container with is Ubuntu 20. I added the following to buildfs.sh for additional debug output:

cat /etc/os-release
echo $PATH
ls -al /usr/bin | grep docker

Which yields:

+ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
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"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
+ echo /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ ls -al /usr/bin
+ grep docker
hugodutka commented 11 months ago

That's a peculiar error. We run ops/bin/local-up.sh in CI on every commit and docker is not missing there. Once https://github.com/hocus-dev/hocus/pull/108 is merged, we will make a new release that completely removes the step that's causing this error, so that should fix the problem.

wilj commented 11 months ago

0.3-alpha fixes it, thank you!