GenieFramework / Genie.jl

🧞The highly productive Julia web framework
https://genieframework.com
MIT License
2.28k stars 192 forks source link

error when running Deploy.Docker.run(mountapp=true) #506

Closed yummy527 closed 2 years ago

yummy527 commented 2 years ago

Describe the bug After successfuly build an image from a Genie webapp, it goes well when I run Deploy.Docker.run(). But an error occurs if the commands is Deploy.Docker.run(mountapp=true).

Error stacktrace

julia> Deploy.Docker.run(mountapp=true)
Starting docker container with `sudo docker run -it --rm -p 80:8000 --name genieapp -v /home/wangxl/Documents/Projects_Webapp/GeoWebapp:/home/genie/app genie`
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "bin/server": permission denied: unknown.
ERROR: failed process: Process(`sudo docker run -it --rm -p 80:8000 --name genieapp -v /home/wangxl/Documents/Projects_Webapp/GeoWebapp:/home/genie/app genie`, ProcessExited(126)) [126]

Stacktrace:
 [1] run
   @ ./process.jl:444 [inlined]
 [2] run(command::Cmd)
   @ Genie.Deploy ~/.julia/packages/Genie/UxbVJ/src/Deploy.jl:5
 [3] |>
   @ ./operators.jl:966 [inlined]
 [4] run(; containername::String, hostport::Int64, containerport::Int64, appdir::String, mountapp::Bool, image::String, command::String, rm::Bool, it::Bool, websockets_hostport::Int64, websockets_containerport::Int64, sudo::Bool)
   @ Genie.Deploy.Docker ~/.julia/packages/Genie/UxbVJ/src/Deploy.jl:120
 [5] top-level scope
   @ REPL[4]:1

To reproduce Steps to reproduce the behavior and/or Julia code executed.

Deploy.Docker.run(mountapp=true)  # this will triger the error

Expected behavior I expect no errors when running Deploy.Docker.run(mountapp=true)

Additional context Please include the output of julia> versioninfo()

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635* (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) W-10885M CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Environment:
  JULIA_PKG_SERVER = https://mirrors.tuna.tsinghua.edu.cn/julia
  JULIA_COPY_STACKS = yes

and pkg> st

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [336ed68f] CSV v0.10.2
  [a10d1c49] DBInterface v2.5.0
  [a93c6f00] DataFrames v1.3.2
  [89b67f3b] ExcelFiles v1.0.0
  [c04bee98] ExcelReaders v0.11.0
  [c43c736e] Genie v4.9.1
  [cd3eb016] HTTP v0.9.17
  [7073ff75] IJulia v1.23.2
  [39abe10b] MySQL v1.2.1
  [d96e819e] Parameters v0.12.3
  [f0f68f2c] PlotlyJS v0.18.8
  [438e738f] PyCall v1.93.0
  [340e8cb6] SearchLight v2.2.0
  [4acbeb90] Stipple v0.21.2
  [ec984513] StipplePlotly v0.10.1
  [bd369af6] Tables v1.6.1
  [61d0e4fa] Taro v0.8.4
  [fdbf4ff8] XLSX v0.7.9
  [44cfe95a] Pkg
essenciary commented 2 years ago

What permissions are set on bin/server?

yummy527 commented 2 years ago

What permissions are set on bin/server?

I change nothing to bin/server in dockerfile.

# pull latest julia image
FROM --platform=linux/amd64 julia:latest

RUN apt-get update
RUN apt-get install -y unzip
# create dedicated user
RUN useradd --create-home --shell /bin/bash genie

# set up the app
RUN mkdir /home/genie/app
COPY . /home/genie/app
WORKDIR /home/genie/app

# configure permissions
RUN chown genie:genie -R *

RUN chmod +x bin/repl
RUN chmod +x bin/server
RUN chmod +x bin/runtask

# switch user
USER genie

# instantiate Julia packages
RUN julia -e "using Pkg; Pkg.activate(\".\"); Pkg.instantiate(); Pkg.precompile(); "

# ports
EXPOSE 8000
EXPOSE 80

# set up app environment
ENV JULIA_DEPOT_PATH "/home/genie/.julia"
ENV GENIE_ENV "dev"
ENV HOST "0.0.0.0"
ENV PORT "8000"
ENV WSPORT "8000"
ENV EARLYBIND "true"

# run app
CMD ["bin/server"]

# or maybe include a Julia file
# CMD julia -e 'using Pkg; Pkg.activate("."); include("IrisClustering.jl"); '

By the way, this command below works well for DockerTest webapp generated in official Genie tutorial, but triggers error for my own webapp.

Deploy.Docker.run(mountapp=true)  # this will trigger the error