首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >命令sudo:找不到

命令sudo:找不到
EN

Stack Overflow用户
提问于 2019-04-10 14:52:22
回答 2查看 6.2K关注 0票数 1

在执行我的init.sh时,我调用以下命令:

sudo bash ${INSTALLPATH}seafile.sh start

在此之后,错误:

seafile_1_f2341d904d27 | /bin/sh: 1: sudo: not found

发生。

打开目录"bin“并查看"sh”,它只是一些不可读的charakter。

调用init.sh的dockerfile通过这样做:

代码语言:javascript
运行
复制
 FROM debian
#FROM armv7/armhf-debian

MAINTAINER me

# install packages
RUN apt-get update && apt-get install sudo -y

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates \
python2.7 \
python-setuptools \
python-imaging \
python-ldap \
python-urllib3 \
sqlite3 \
wget

# Copy scripts
ADD ./scripts /scripts

# set environment variables
ENV SERVER_NAME mdh-seafile
ENV SERVER_IP 127.0.0.1
ENV FILESERVER_PORT 8082
ENV SEAFILE_DIR /data
ENV SEAFILE_VERSION seafile-server-6.3.4
ENV INSTALLPATH /opt/seafile/${SEAFILE_VERSION}/

# clean for smaller image
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Volumes for persistent configuration
VOLUME /opt/seafile/

# added
COPY /opt/seafile/${SEAFILE_VERSION}/seafile.sh .
COPY /opt/seafile/${SEAFILE_VERSION}/seahub.sh .


# set entrypoint
ENTRYPOINT sudo bash /scripts/init.sh

Init.sh:

代码语言:javascript
运行
复制
else
  # start seafile
  # whoami -> Output: root
  sudo bash ${INSTALLPATH}seafile.sh start
  sudo bash ${INSTALLPATH}seahub.sh start
  # keep seafile running in foreground to prevent docker container shutting down
  while true; do
    sudo tail -f /opt/seafile/logs/seafile.log
    sleep 10
  done

fi

我是通过调用sudo bash install.sh来执行所有的操作,它正在执行连接到组件的docker文件。

码头工人-组成:

代码语言:javascript
运行
复制
version: '2'
services:

  db:
    #image: hypriot/rpi-mysql
    image: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=###
    volumes:
    - /mnt/data/mysql:/var/lib/mysql

  duply:
    build: .
    volumes:
      - ./config:/config
      - /mnt/data:/mnt/data
      - ./webinterface:/var/www/html/MyDigitalHome
      - /mnt/guestbackup:/mnt/guestbackup/backup
      #- /mnt/usb-removable:/usb-removable
    ports:
      - "8080:80"
      - "24:22"
    links:
      - db
  seafile:
    build: seafile/
    volumes:
      - ./seafile/config:/config
      - /mnt/data/seafile:/data
    ports:
      - "8000:8000"
      - "8082:8082"
    environment:
      - SEAFILE_ADMIN=###@mydigitalhome.xy
      - SEAFILE_ADMIN_PW=###


  owncloud:
    build: owncloud/
    volumes:
      - /mnt/data/owncloud:/data
      - ./owncloud/config:/var/www/html/config
    ports:
      - "8090:80"
    links:
      - db:mysql

当前的错误是:

代码语言:javascript
运行
复制
ERROR: Service 'seafile' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder845725722/opt/seafile/seafile-server-6.3.4/seafile.sh: no such file or directory

Attaching to mdh_seafile_1_f2341d904d27, mdh_db_1_46bebe733124, mdh_duply_1_170a5db26129, mdh_owncloud_1_260c3a56f2a5
seafile_1_f2341d904d27 | bash: seafile.sh: No such file or directory
seafile_1_f2341d904d27 | bash: seahub.sh: No such file or directory
seafile_1_f2341d904d27 | tail: cannot open '/opt/seafile/logs/seafile.log' for reading: No such file or directory
seafile_1_f2341d904d27 | tail: no files remaining
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-04-10 14:56:51

debian映像开始,您需要安装sudo,可以将RUN apt-get update && apt-get install sudo -y添加到Dockerfile的开头。然后用docker build .重建映像,然后再次运行命令。

票数 0
EN

Stack Overflow用户

发布于 2019-04-10 14:58:09

我猜你是在码头经营这件事。您可以添加到您的dockerfile中。

RUN apt update && apt install -y sudo

这应该能解决你的问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55615587

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档