gpt4 book ai didi

docker - 如何找到Shiny-Server可执行文件并在Shiny-server.sh中引用它?

转载 作者:行者123 更新时间:2023-12-02 19:30:02 25 4
gpt4 key购买 nike

我的docker镜像构建似乎进行得很好,但是,我在使用 Shiny 的服务器可执行文件时遇到问题。主要地,shiny-server可执行文件在shiny-server.sh中被引用如下:

#!/bin/sh

# Make sure the directory for individual app logs exists
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server

exec shiny-server >> /var/log/shiny-server.log 2>&1

上面的代码对我不起作用(不知道为什么),所以我不得不将其更改为这种方式:
#!/bin/bash

# Make sure the directory for individual app logs exists
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server

if [ "$APPLICATION_LOGS_TO_STDOUT" = "false" ];
then
exec shiny-server 2>&1
else
# start shiny server in detached mode
exec shiny-server 2>&1 &

# push the "real" application logs to stdout with xtail
exec xtail /var/log/shiny-server/
fi

但是,出现以下错误:
$ docker run -p 80:8080 fitfarmz3

*** warning - no files are being watched ***
/usr/bin/shiny-server.sh: line 12: shiny-server: No such file or directory

将不胜感激如何解决此问题。

这里我包括了dockerfile:
FROM r-base:3.5.0

# Install Ubuntu packages
RUN apt-get update && apt-get install -y \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev/unstable \
libxt-dev \
libssl-dev


# Add shiny user
RUN groupadd shiny \
&& useradd --gid shiny --shell /bin/bash --create-home shiny



# Download and install ShinyServer
RUN wget --no-verbose https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb && \
gdebi shiny-server-1.5.7.907-amd64.deb


# Install R packages that are required
RUN R -e "install.packages(c('Benchmarking', 'plotly', 'DT'), repos='http://cran.rstudio.com/')"
RUN R -e "install.packages('shiny', repos='https://cloud.r-project.org/')"

# Copy configuration files into the Docker image
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf
COPY /app /srv/shiny-server/

# Make the ShinyApp available at port 80
EXPOSE 80

# Copy further configuration files into the Docker image
COPY shiny-server.sh /usr/bin/shiny-server.sh

CMD ["/usr/bin/shiny-server.sh"]

最佳答案

因此出于某种原因,gdebi没有安装shiny-server。您可以通过以下方式在Dockerfile中安装它:

运行wget --no-verbose https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.7.907-amd64.deb && \
dpkg -i Shiny 服务器1.5.7.907-amd64.deb

为我工作。希望能帮助到你!

关于docker - 如何找到Shiny-Server可执行文件并在Shiny-server.sh中引用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52377910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com