# Kubernetes-pod-fails-with-crashloopbackoff while deploying using docker image on GCP

**URL:** <https://discourse.julialang.org/t/kubernetes-pod-fails-with-crashloopbackoff-while-deploying-using-docker-image-on-gcp/68912>\
**Category:** General Usage\
**Tags:** question, docker, kubernetes\
**Created:** [September 29, 2021, 9:35am UTC](https://discourse.julialang.org/t/kubernetes-pod-fails-with-crashloopbackoff-while-deploying-using-docker-image-on-gcp/68912 "2021-09-29T09:35:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdsa3d](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mdsa3d/32/20389_2.png) [@mdsa3d](https://discourse.julialang.org/u/mdsa3d)\
**Post date:** [September 29, 2021, 9:35am UTC](https://discourse.julialang.org/t/kubernetes-pod-fails-with-crashloopbackoff-while-deploying-using-docker-image-on-gcp/68912/1 "2021-09-29T09:35:21Z")

</div>

Hi, I created a docker file for my application:

```julia
FROM julia:1.6
RUN apt-get update && apt-get install -y gcc 
ENV JULIA_PROJECT @. 
WORKDIR /home 
ENV VERSION 1 
ADD . /home 
RUN julia deploy/packagecompile.jl 
EXPOSE 8080 
ENTRYPOINT ["julia", "-JApp.so", "-t", "auto", "-L", "src/App.jl"]

```

In this application the `App.jl` is starting `server` using the following command:

```julia
Genie.startup(8080, "localhost", async=true)

```

Using above parameters, I managed to successfully create the docker image. However when I deploy the image on `GCP` Kubernetes, I get an error

```julia
kubernetes-pod-fails-with-crashloopbackoff 

```

I researched on this issue and found out that the kubernete container closes after executing the docker image.  
Ref: [docker - Kubernetes Pod fails with CrashLoopBackOff - Stack Overflow](https://stackoverflow.com/questions/44702715/kubernetes-pod-fails-with-crashloopbackoff)

May I ask, Is there a way where I can keep this server running just using my docker image?  
Thanks! Look forward to the suggestions.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [September 29, 2021, 9:50am UTC](https://discourse.julialang.org/t/kubernetes-pod-fails-with-crashloopbackoff-while-deploying-using-docker-image-on-gcp/68912/2 "2021-09-29T09:50:26Z")

</div>

I haven’t used Genie before, but I’m guessing `async=true` means that `startup` command doesn’t block and instead returns execution to you. If there’s no more commands in the script, then the script will exit. You can try this without docker by running `julia -L src/App.jl` yourself.

So perhaps the fix is to pass `async=false` instead.

---

<div class="post-metadata">

**Author:** ![mdsa3d](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mdsa3d/32/20389_2.png) [@mdsa3d](https://discourse.julialang.org/u/mdsa3d)\
**Post date:** [September 29, 2021, 9:54am UTC](https://discourse.julialang.org/t/kubernetes-pod-fails-with-crashloopbackoff-while-deploying-using-docker-image-on-gcp/68912/3 "2021-09-29T09:54:25Z")

</div>

Thanks @ericphanson for the response, highly appreciate it!  
Indeed `async=false` keeps the server running, but I am using the `client.jl` as a test file and also to build the precompilation of the project.  
And `async=false` doesn’t allow for the following code and files to be executed.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [September 29, 2021, 11:15am UTC](https://discourse.julialang.org/t/kubernetes-pod-fails-with-crashloopbackoff-while-deploying-using-docker-image-on-gcp/68912/4 "2021-09-29T11:15:20Z")

</div>

Ah, I see. I think in that case you want to `wait` on the async tasks at the end of the script, so the script doesn’t finish until they do. Maybe Genie returns those tasks somehow for you to wait on them?
