saschagrunert / webapp.rs

A web application completely written in Rust. 🌍

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust Error on Docker Run Image

TrustTheRust opened this issue · comments

The build works just fine on ubuntu but I'm receiving this elusive rust error on 'sudo docker run'

Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

This is a clean install on ubuntu 16.04, instructions worked fine but the image did not start up, i then ran manually and found this error.
The resulting internet searches for this error are not very helpful and this may be an easy fix. Any ideas anyone? Thanks.

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.57. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Hey @TrustTheRust, can you please provide more details about the commands you run? Which operating system are you on?

Yes,

OS:
Ubuntu 16.04 LTS, Zorin OS 12.4

Commands Run:
1: "git clone https://github.com/saschagrunert/webapp.rs.git" => "cd webapp" =>

2: "sudo nano Config.rs" => Changed to a working remote PG DB

3: "sudo nano Makefile" => changed podman to docker

4: "make all" => "Finished processing of "app.wasm"!"

5: "sudo make deploy" => " Finished release [optimized] target(s) in 1m 55s
Sending build context to Docker daemon 318.4MB
Step 1/4 : FROM scratch
--->
Step 2/4 : COPY target/x86_64-unknown-linux-musl/release/backend /
---> 6c0d2ecae6a6
Step 3/4 : COPY target/deploy /static
---> d9bd502250c4
Step 4/4 : ENTRYPOINT ["/backend"]
---> Running in 49291a292729
Removing intermediate container 49291a292729
---> 82dbb0c7e7b3
Successfully built 82dbb0c7e7b3
Successfully tagged webapp:latest"

6: "sudo docker ps" => "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES"
^^^ Note: No Container Created

7: "sudo docker images" => "REPOSITORY TAG IMAGE ID CREATED SIZE
webapp latest 82dbb0c7e7b3 28 seconds ag"

8: "sudo docker run webapp:latest" => "Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }"

Which OS are you seeing success on? Any ideas how to trace this bug?
I'm willing to test multiple OS versions and report the results if it helps another on here. Really want to get this working as intended.

Running Ubuntu 18.04.3 LTS have the same issue:
"sudo docker run webapp:latest" => "Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }"

Yeah the thing is that you have to mount the configuration into the container, like in the run-app Makefile target:

webapp.rs/Makefile

Lines 80 to 90 in 4115c0f

run-app: run-postgres
if [ ! "$(shell $(CONTAINER_RUNTIME) ps -q -f name=webapp)" ]; then \
$(CONTAINER_RUNTIME) run --rm \
--name webapp \
--network="host" \
-v $(shell pwd)/backend/tls:/tls \
-v $(shell pwd)/Config.toml:/Config.toml \
-d webapp ;\
else \
echo "App already running" ;\
fi

I decided to not add the config as part of the container image because it may contain sensitive data :)