VSCode Docker Server in Fly.io not working

447 Views Asked by At

I am new to Docker and dont know what I am doing wrong. I trying to host a VSCode Server using Fly.io. I have cloned this Repo on my Local Windows PC and I am trying to deploy it to Fly.io. (The Repo already has a Dockerfile) This is what I do.

PS C:\Users\#####\OneDrive\Desktop\docker-code-server-master> flyctl launch
Creating app in C:\Users\######\OneDrive\Desktop\docker-code-server-master
Scanning source code
Detected a Dockerfile app
? Choose an app name (leave blank to generate one): vscode-collin

? Choose an app name (leave blank to generate one): vscode-collin
automatically selected personal organization: ########
? Choose a region for deployment: Frankfurt, Germany (fra)
Created app vscode-collin in organization personal
Admin URL: https://fly.io/apps/vscode-collin
Hostname: vscode-collin.fly.dev
Wrote config file fly.toml
? Would you like to set up a Postgresql database now? No
? Would you like to set up an Upstash Redis database now? No
? Would you like to deploy now? No
Your app is ready! Deploy with `flyctl deploy`

Then, I deploy it.

PS C:\Users\#####\OneDrive\Desktop\docker-code-server-master> flyctl deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-crimson-thunder-5765 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  27.86kB
[+] Building 30.4s (7/7) FINISHED
 => [internal] load remote build context                                                                           0.0s
 => copy /context /                                                                                                0.1s
 => [internal] load metadata for ghcr.io/linuxserver/baseimage-ubuntu:jammy                                        1.7s
 => [1/3] FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy@sha256:219a007e0ab917708b8ce78332ff9a4b33d7926957b6f4aa  3.2s
 => => resolve ghcr.io/linuxserver/baseimage-ubuntu:jammy@sha256:219a007e0ab917708b8ce78332ff9a4b33d7926957b6f4aa  0.0s
 => => sha256:8a6b84e63e3d4d8bfabb54bb67cf346d9067c12f56249ee523c3a481f1b93fd7 32.82MB / 32.82MB                   1.3s
 => => sha256:665a26860e09ef8030830255032e3fd7a21141743338294b6bafabaf462a1296 2.84kB / 2.84kB                     0.5s
 => => sha256:e5afe0e25c04abfbb87624d14ea12b467ea92a8e4edd39d728bbe57b18f8c235 274B / 274B                         0.3s
 => => sha256:b0dc43af3c2f8f5ec023894639a8369c13db45b0a44d68be635ea68c33dd8a19 13.60MB / 13.60MB                   1.6s
 => => sha256:90fe4b5ce9837a29f8355364dc65cda42dfe6769112f1e5f20e7d399b4d75de2 4.01kB / 4.01kB                     0.5s
 => => sha256:219a007e0ab917708b8ce78332ff9a4b33d7926957b6f4aa857adbe48066ed29 1.11kB / 1.11kB                     0.0s
 => => sha256:f2262dfce3b2109988200e657911331db1e44c1ca199b7763598a478e507f88f 1.36kB / 1.36kB                     0.0s
 => => sha256:90e83878b60882bc5b9dcd3faf9c8dfeda495fdbbeeae9bce4884cd22ab4ff51 6.29kB / 6.29kB                     0.0s
 => => extracting sha256:8a6b84e63e3d4d8bfabb54bb67cf346d9067c12f56249ee523c3a481f1b93fd7                          1.0s
 => => extracting sha256:665a26860e09ef8030830255032e3fd7a21141743338294b6bafabaf462a1296                          0.0s
 => => extracting sha256:e5afe0e25c04abfbb87624d14ea12b467ea92a8e4edd39d728bbe57b18f8c235                          0.0s
 => => extracting sha256:b0dc43af3c2f8f5ec023894639a8369c13db45b0a44d68be635ea68c33dd8a19                          0.6s
 => => extracting sha256:90fe4b5ce9837a29f8355364dc65cda42dfe6769112f1e5f20e7d399b4d75de2                          0.0s
 => [2/3] RUN   echo "**** install runtime dependencies ****" &&   apt-get update &&   apt-get install -y     gi  21.9s
 => [3/3] COPY /root /                                                                                             0.0s
 => exporting to image                                                                                             3.5s
 => => exporting layers                                                                                            3.4s
 => => writing image sha256:f06211a1bcf40f54d78e47440cc9a98204d91b21b3ae9f437485e002f26e9154                       0.0s
 => => naming to registry.fly.io/vscode-collin:deployment-01GNW1KE31D3GFRD67VHCDEC9F                               0.0s
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/vscode-collin]
0e0a3a08e766: Pushed
a7a4c99764a8: Pushed
119543c8aa54: Pushed
b91b76d0cec5: Pushed
1ed3ce823e57: Pushed
ef2d7d76cefe: Pushed
c00ff9c5d6c4: Pushed
deployment-01GNW1KE31D3GFRD67VHCDEC9F: digest: sha256:4a33ea0127c4b1aaee89badf023ef60195ce7c57e644faad18dd91a6e3ee45c5 size: 1785
--> Pushing image done
image: registry.fly.io/vscode-collin:deployment-01GNW1KE31D3GFRD67VHCDEC9F
image size: 597 MB
==> Creating release
--> release v2 created

--> You can detach the terminal anytime without stopping the deployment
==> Monitoring deployment
Logs: https://fly.io/apps/vscode-collin/monitoring

 1 desired, 1 placed, 0 healthy, 1 unhealthy [restarts: 2] [health checks: 1 total]
Failed Instances

Failure #1

Instance
ID              PROCESS VERSION REGION  DESIRED STATUS  HEALTH CHECKS   RESTARTS        CREATED
35939421        app     0       fra     run     pending 1 total         2               3m19s ago

Recent Events
TIMESTAMP               TYPE            MESSAGE
2023-01-03T14:48:32Z    Received        Task received by client
2023-01-03T14:48:32Z    Task Setup      Building Task Directory
2023-01-03T14:49:10Z    Started         Task started by client
2023-01-03T14:49:12Z    Terminated      Exit Code: 100
2023-01-03T14:49:12Z    Restarting      Task restarting in 1.06913957s
2023-01-03T14:51:09Z    Started         Task started by client
2023-01-03T14:51:11Z    Terminated      Exit Code: 100
2023-01-03T14:51:11Z    Restarting      Task restarting in 1.052215297s

2023-01-03T14:49:00Z   [info]Unpacking image
2023-01-03T14:49:09Z   [info]Preparing kernel init
2023-01-03T14:49:09Z   [info]Configuring firecracker
2023-01-03T14:49:09Z   [info]Starting virtual machine
2023-01-03T14:49:10Z   [info]Starting init (commit: f447594)...
2023-01-03T14:49:10Z   [info]Preparing to run: `/init` as root
2023-01-03T14:49:10Z   [info]2023/01/03 14:49:10 listening on [fdaa:0:ba86:a7b:67:3593:9421:2]:22 (DNS: [fdaa::3]:53)
2023-01-03T14:49:11Z   [info]Starting clean up.
2023-01-03T14:49:16Z   [info]Starting instance
2023-01-03T14:49:19Z   [info]Configuring virtual machine
2023-01-03T14:49:19Z   [info]Pulling container image
2023-01-03T14:49:55Z   [info]Unpacking image
2023-01-03T14:51:08Z   [info]Preparing kernel init
2023-01-03T14:51:09Z   [info]Configuring firecracker
2023-01-03T14:51:09Z   [info]Starting virtual machine
2023-01-03T14:51:09Z   [info]Starting init (commit: f447594)...
2023-01-03T14:51:09Z   [info]Preparing to run: `/init` as root
2023-01-03T14:51:09Z   [info]2023/01/03 14:51:09 listening on [fdaa:0:ba86:a7b:67:3593:9421:2]:22 (DNS: [fdaa::3]:53)
2023-01-03T14:51:10Z   [info]Starting clean up.
2023-01-03T14:51:15Z   [info]Starting instance
2023-01-03T14:51:17Z   [info]Configuring virtual machine
2023-01-03T14:51:17Z   [info]Pulling container image
2023-01-03T14:51:48Z   [info]Unpacking image
2023-01-03T14:51:57Z   [info]Preparing kernel init
2023-01-03T14:51:58Z   [info]Configuring firecracker
2023-01-03T14:51:58Z   [info]Starting virtual machine
2023-01-03T14:51:58Z   [info]Starting init (commit: f447594)...
2023-01-03T14:51:58Z   [info]Preparing to run: `/init` as root
2023-01-03T14:51:58Z   [info]2023/01/03 14:51:58 listening on [fdaa:0:ba86:a7b:67:3593:9421:2]:22 (DNS: [fdaa::3]:53)
2023-01-03T14:51:59Z   [info]Starting clean up.
--> v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

I dont know why it doesnt work. Please tell me what I should do. I also had this Issue a few Days ago when I tried hosting SearxNG, because I saw it in a YouTube Video. I just gave up on SearxNG. Discord Bots work fine on Fly.io. Is there something wrong with the Dockerfile? Please help me.

1

There are 1 best solutions below

0
On

So, there's a whole host of reasons why your deployment could be failing; when Fly fails it's health checks it kills the latest version of your app and attempts to rollback to the previous, healthy, version. If there isn't one, it'll just fail and there's nothing to roll back to.

The first thing to check is your logs, to see if there are any specific error messages that could inform you what went wrong, perhaps your instance ran out of memory for example. You can do this with: flyctl logs.

It could also be that you haven't set your environment variables. If you have secret variables you don't want exposed in source control you need to read about using Fly secrets here. For environment variables you have no issue with being in source control, you need to set them under your [env] in your fly.toml config like so (an example from a Laravel app):

[env]
    APP_ENV = "production"
    APP_URL = "https://test.fly.dev"
    APP_DEBUG = "false"
    MAIL_FROM_ADDRESS = "[email protected]"
    MAIL_FROM_NAME = "www.test.co.uk"
    LOG_CHANNEL = "stderr"
    LOG_LEVEL = "info"
    LOG_STDERR_FORMATTER = "Monolog\\Formatter\\JsonFormatter"
    DB_CONNECTION = "test"
    DB_HOST = "lhr.test.internal"
    DB_DATABASE= "test"

Other than that, you should check out the Fly page they have for debugging unhealthy allocations, it'll likely contain the answer to fixing your issue.