AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-68091

Ignacio's questions

Martin Hope
Ignacio
Asked: 2018-07-13 15:46:30 +0800 CST

dockercontainer 启动时运行脚本?

  • 3

如果我基于 Debian 创建一个 dockerfile,我可以在启动容器时添加以下行来执行脚本:

COPY userconf.sh /etc/cont-init.d/userconf

基于 Ubuntu 16.04 的 dockerfile 的等价物是什么?如果相关,这是我要运行的脚本。


我尝试实施@AB 推荐的更改,但仍然无法正常工作。这是我的码头文件:

FROM r-gpu

ARG RSTUDIO_VERSION
## Comment the next line to use the latest RStudio Server version by default
#ENV RSTUDIO_VERSION=${RSTUDIO_VERSION:-1.1.447}
ENV PATH=/usr/lib/rstudio-server/bin:$PATH

## Download and install RStudio server & dependencies
## Attempts to get detect latest version, otherwise falls back to version given in $VER
## Symlink pandoc, pandoc-citeproc so they are available system-wide
RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    git \
    libedit2 \
    psmisc \
    python-setuptools \
    sudo \
    wget \
  && RSTUDIO_LATEST=$(wget --no-check-certificate -qO- https://s3.amazonaws.com/rstudio-server/current.ver) \
  && [ -z "$RSTUDIO_VERSION" ] && RSTUDIO_VERSION=$RSTUDIO_LATEST || true \
  && wget -q http://download2.rstudio.org/rstudio-server-${RSTUDIO_VERSION}-amd64.deb \
  && dpkg -i rstudio-server-${RSTUDIO_VERSION}-amd64.deb \
  && rm rstudio-server-*-amd64.deb \
  ## Symlink pandoc & standard pandoc templates for use system-wide
  && ln -s /usr/lib/rstudio-server/bin/pandoc/pandoc /usr/local/bin \
  && ln -s /usr/lib/rstudio-server/bin/pandoc/pandoc-citeproc /usr/local/bin \
  && git clone https://github.com/jgm/pandoc-templates \
  && mkdir -p /opt/pandoc/templates \
  && cp -r pandoc-templates*/* /opt/pandoc/templates && rm -rf pandoc-templates* \
  && mkdir /root/.pandoc && ln -s /opt/pandoc/templates /root/.pandoc/templates \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/ \
  && mkdir -p /usr/local/lib/R/etc \
  ## RStudio wants an /etc/R, will populate from $R_HOME/etc
  && mkdir -p /etc/R \
  ## Write config files in $R_HOME/etc
  && echo '\n\
    \n# Configure httr to perform out-of-band authentication if HTTR_LOCALHOST \
    \n# is not set since a redirect to localhost may not work depending upon \
    \n# where this Docker container is running. \
    \nif(is.na(Sys.getenv("HTTR_LOCALHOST", unset=NA))) { \
    \n  options(httr_oob_default = TRUE) \
    \n}' >> /usr/local/lib/R/etc/Rprofile.site \
  && echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron \
  ## Prevent rstudio from deciding to use /usr/bin/R if a user apt-get installs a package
  &&  echo 'rsession-which-r=/usr/local/bin/R' >> /etc/rstudio/rserver.conf \
  ## use more robust file locking to avoid errors when using shared volumes:
  && echo 'lock-type=advisory' >> /etc/rstudio/file-locks \
  ## configure git not to request password each time
  && git config --system credential.helper 'cache --timeout=3600' \
  && git config --system push.default simple \
  ## Set up S6 init system
  && wget -P /tmp/ https://github.com/just-containers/s6-overlay/releases/download/v1.11.0.1/s6-overlay-amd64.tar.gz \
  && tar xzf /tmp/s6-overlay-amd64.tar.gz -C / \
  && mkdir -p /etc/services.d/rstudio \
  && echo '#!/usr/bin/with-contenv bash \
           \n exec /usr/lib/rstudio-server/bin/rserver --server-daemonize 0' \
           > /etc/services.d/rstudio/run \
   && echo '#!/bin/bash \
           \n rstudio-server stop' \
           > /etc/services.d/rstudio/finish

COPY userconf.sh /usr/local/bin/userconf.sh

## running with "-e ADD=shiny" adds shiny server
COPY add_shiny.sh /usr/local/bin/add_shiny.sh

COPY pam-helper.sh /usr/local/bin/pam-helper.sh

COPY start.sh /usr/local/bin/start.sh

RUN ln /usr/bin/R /usr/local/bin/R

EXPOSE 8787

CMD ["/bin/bash", "/usr/local/bin/start.sh"]

这是userconf.sh:

#!/usr/bin/env bash

## Set defaults for environmental variables in case they are undefined
USER=${USER:=rstudio}
PASSWORD=${PASSWORD:=rstudio}
USERID=${USERID:=1000}
GROUPID=${GROUPID:=1000}
ROOT=${ROOT:=FALSE}
UMASK=${UMASK:=022}


if [ "$USERID" -lt 1000 ]
# Probably a macOS user, https://github.com/rocker-org/rocker/issues/205
  then
    echo "$USERID is less than 1000"
    check_user_id=$(grep -F "auth-minimum-user-id" /etc/rstudio/rserver.conf)
    if [[ ! -z $check_user_id ]]
    then
      echo "minumum authorised user already exists in /etc/rstudio/rserver.conf: $check_user_id"
    else
      echo "setting minumum authorised user to 499"
      echo auth-minimum-user-id=499 >> /etc/rstudio/rserver.conf
    fi
fi

if [ "$USERID" -ne 1000 ]
## Configure user with a different USERID if requested.
  then
    echo "deleting user rstudio"
    userdel rstudio
    echo "creating new $USER with UID $USERID"
    useradd -m $USER -u $USERID
    mkdir /home/$USER
    chown -R $USER /home/$USER
    usermod -a -G staff $USER
elif [ "$USER" != "rstudio" ]
  then
    ## cannot move home folder when it's a shared volume, have to copy and change permissions instead
    cp -r /home/rstudio /home/$USER
    ## RENAME the user   
    usermod -l $USER -d /home/$USER rstudio
    groupmod -n $USER rstudio
    usermod -a -G staff $USER
    chown -R $USER:$USER /home/$USER
    echo "USER is now $USER"  
fi

if [ "$GROUPID" -ne 1000 ]
## Configure the primary GID (whether rstudio or $USER) with a different GROUPID if requested.
  then
    echo "Modifying primary group $(id $USER -g -n)"
    groupmod -g $GROUPID $(id $USER -g -n)
    echo "Primary group ID is now custom_group $GROUPID"
fi

## Add a password to user
echo "$USER:$PASSWORD" | chpasswd

# Use Env flag to know if user should be added to sudoers
if [ "$ROOT" == "TRUE" ]
  then
    adduser $USER sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
    echo "$USER added to sudoers"
fi

## Change Umask value if desired
if [ "$UMASK" -ne 022 ]
  then
    echo "server-set-umask=false" >> /etc/rstudio/rserver.conf
    echo "Sys.umask(mode=$UMASK)" >> /home/$USER/.Rprofile
fi

## add these to the global environment so they are avialable to the RStudio user 
echo "HTTR_LOCALHOST=$HTTR_LOCALHOST" >> /etc/R/Renviron.site
echo "HTTR_PORT=$HTTR_PORT" >> /etc/R/Renviron.site

这是 start.sh

#!/usr/bin/env bash

/usr/local/bin/userconf.sh
/usr/local/bin/add_shiny.sh
/usr/local/bin/pam-helper.sh

exec /usr/lib/rstudio-server/bin/rserver --server-daemonize=0 --server-app-armor-enabled=0

我错过了什么?

init.d docker
  • 1 个回答
  • 32172 Views
Martin Hope
Ignacio
Asked: 2017-03-15 10:26:59 +0800 CST

如果那里有文件,则监视文件夹并运行命令?

  • 6

我想要我的 Ubuntu 显示器Folder A。如果那里有.sh文件,我想将该文件移动到Folder B后台并在后台运行它。这可能吗?我应该用什么来实现它?

command-line
  • 2 个回答
  • 15218 Views
Martin Hope
Ignacio
Asked: 2016-05-22 15:14:21 +0800 CST

Keepass kdb 支持吗?

  • 16

有没有办法kdb在 ubuntu 16.04 上打开文件而无需将其转换为kdbx. 我想继续使用kdb,因为这是我可以在 Windows 计算机上打开的唯一格式,我没有管理员权限来安装其他兼容的东西kdbx

16.04
  • 2 个回答
  • 10362 Views
Martin Hope
Ignacio
Asked: 2015-08-08 09:46:51 +0800 CST

自由空间不一致

  • 2

我正在运行 ubuntu 14.04。它一直告诉我空间不足。

在左侧,我的屏幕截图显示我有 6.3 GB 的可用空间,但在右侧显示为 300MB。到底是怎么回事?我该如何解决?

在此处输入图像描述

ignacio@UltraPro:~$ df -h 
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  9.7M  1.6G   1% /run
/dev/sdb1       110G  105G  227M 100% /
tmpfs           7.8G   75M  7.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1       917G  446G  425G  52% /1TB
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs           1.6G   60K  1.6G   1% /run/user/1000

在此处输入图像描述

disk-usage
  • 2 个回答
  • 369 Views
Martin Hope
Ignacio
Asked: 2015-05-29 14:17:22 +0800 CST

webapp-container粘贴密码?

  • 1

我使用webapp-container. 例如:

[Desktop Entry]
Name=KodiRemote
Comment=Kodi Remote
Type=Application
Icon=/1TB/Seafile/icons/kodi.png
Exec=webapp-container --maximized --store-session-cookies --webappUrlPatterns=https?://192.168.1.161:8297/* http://192.168.1.161:8297
Terminal=false
X-Ubuntu-Touch=true

问题是有些应用程序需要很长很复杂的密码,我无法复制和粘贴。crl+v 不起作用,点击只给我复制选项。除了手动输入密码外,还有其他解决方案吗?

谢谢!

webapps
  • 1 个回答
  • 107 Views
Martin Hope
Ignacio
Asked: 2015-05-25 02:55:56 +0800 CST

Ubuntu 15.04 中的 Cisco AnyConnect 兼容 VPN(openconnect)?

  • 23

我安装了 Cisco AnyConnect 兼容 VPN (openconnect)

$ sudo apt-get install network-manager-openconnect
Reading package lists... Done
Building dependency tree       
Reading state information... Done
network-manager-openconnect is already the newest version.

但是当我去添加 VPN 时,我没有添加 openconnect vpn 的选项

截屏

我在 14.04 中没有遇到任何问题:( 想法?

谢谢!

15.04
  • 4 个回答
  • 82998 Views
Martin Hope
Ignacio
Asked: 2015-04-06 04:17:17 +0800 CST

在 ubuntu 14.04 上安装 plyr

  • 3

我正在尝试在 ubuntu 14.04 上安装 plyr 并收到此错误:

* installing *source* package ‘plyr’ ...
** package ‘plyr’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include      -I"/usr/lib/R/site-library/Rcpp/include"   -fpic  -O3 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2    -c RcppExports.cpp -o RcppExports.o
g++: error: unrecognized command line option ‘-fstack-protector-strong’
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘plyr’
* removing ‘/home/ignacio/R/x86_64-pc-linux-gnu-library/3.1/plyr’

The downloaded source packages are in
    ‘/tmp/Rtmp1Rmysx/downloaded_packages’
Warning message:
In install.packages("plyr", dep = TRUE) :
  installation of package ‘plyr’ had non-zero exit status

我错过了什么?

14.04
  • 1 个回答
  • 5889 Views
Martin Hope
Ignacio
Asked: 2015-03-04 06:56:18 +0800 CST

仅用于 ssh 的 Cisco VPN 连接?

  • 3

为了通过 ssh 连接到计算机,我需要连接到它的 Cisco AnyConnect 兼容 VPN (openconnect) 服务器。

我可以毫无问题地做到这一点,但我只想使用 vpn 路由 ssh 流量。主要是因为我希望能够使用远程桌面访问我的计算机,而当连接到 vpn 时我无法这样做。

这可能吗?如何?


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.1.9.1        0.0.0.0         UG    0      0        0 eth0
10.1.9.0        0.0.0.0         255.255.255.0   U     1      0        0 eth0
128.143.1.0     0.0.0.0         255.255.255.0   U     0      0        0 vpn0
128.143.20.85   0.0.0.0         255.255.255.255 UH    0      0        0 vpn0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.35.48.194   10.1.9.1        255.255.255.255 UGH   0      0        0 eth0
vpn
  • 1 个回答
  • 1942 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve