Onlyoffice-Document-Server的Docker安装失败,错误为没有此类文件或目录

a64a0gku  于 2023-01-20  发布在  Docker
关注(0)|答案(1)|浏览(1132)

我尝试通过docker-compose. yml和docker文件安装基于docker的OnlyOffice文档服务器。我通过

git clone https://github.com/ONLYOFFICE/Docker-DocumentServer

系统环境:

OS: openSUSE Leap 15.3
Docker version 20.10.14-ce, build 87a90dc786bd
docker-compose version 1.27.4, build 40524192

通过构建onlyoffice-documentserver,我得到了以下错误消息的dockerfile步骤步骤5/15:
错误:服务"onlyoffice-documentserver"无法生成:无法创建填充程序:OCI运行时创建失败:浏览次数:380次启动容器进程导致:执行代码:"/bin/sh ":统计/分组/sh:没有这样的文件或目录:未知
我的Docker合成文件:

version: '2'
services:
  onlyoffice-documentserver:
    build:
      context: .
    container_name: onlyoffice-documentserver
    depends_on:
      - onlyoffice-postgresql
      - onlyoffice-rabbitmq
    environment:
      - DB_TYPE=postgres
      - DB_HOST=onlyoffice-postgresql
      - DB_PORT=5432
      - DB_NAME=onlyoffice
      - DB_USER=onlyoffice
      - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq
      # Uncomment strings below to enable the JSON Web Token validation.
      #- JWT_ENABLED=true
      #- JWT_SECRET=secret
      #- JWT_HEADER=Authorization
      #- JWT_IN_BODY=true
    ports:
      - '2085:80'
    stdin_open: true
    restart: always
    stop_grace_period: 60s
    volumes:
       - /var/www/onlyoffice/Data
       - /var/log/onlyoffice
       - /var/lib/onlyoffice/documentserver/App_Data/cache/files
       - /var/www/onlyoffice/documentserver-example/public/files
       - /usr/share/fonts
       
  onlyoffice-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: always
    expose:
      - '5672'

  onlyoffice-postgresql:
    container_name: onlyoffice-postgresql
    image: postgres:9.5
    environment:
      - POSTGRES_DB=onlyoffice
      - POSTGRES_USER=onlyoffice
      - POSTGRES_HOST_AUTH_METHOD=trust
    restart: always
    expose:
      - '5432'
    volumes:
      - postgresql_data:/var/lib/postgresql

volumes:
  postgresql_data:

我的dockerfile内容:

ROM ubuntu:20.04
    LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
    
    ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=12
    
    ARG ONLYOFFICE_VALUE=onlyoffice
    
    RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
        apt-get -y update && \
        apt-get -yq install wget apt-transport-https gnupg locales && \
        mkdir -p $HOME/.gnupg && \
        gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/onlyoffice.gpg --keyserver keyserver.ubuntu.com --recv-keys 0x8320ca65cb2de8e5 && \
        chmod 644 /etc/apt/trusted.gpg.d/onlyoffice.gpg && \
        locale-gen en_US.UTF-8 && \
        echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
        apt-get -yq install \
            adduser \
            apt-utils \
            bomstrip \
            certbot \
            curl \
            gconf-service \
            htop \
            libasound2 \
            libboost-regex-dev \
            libcairo2 \
            libcurl3-gnutls \
            libcurl4 \
            libgtk-3-0 \
            libnspr4 \
            libnss3 \
            libstdc++6 \
            libxml2 \
            libxss1 \
            libxtst6 \
            mysql-client \
            nano \
            net-tools \
            netcat-openbsd \
            nginx-extras \
            postgresql \
            postgresql-client \
            pwgen \
            rabbitmq-server \
            redis-server \
            software-properties-common \
            sudo \
            supervisor \
            ttf-mscorefonts-installer \
            xvfb \
            zlib1g && \
        if [  $(ls -l /usr/share/fonts/truetype/msttcorefonts | wc -l) -ne 61 ]; \
            then echo 'msttcorefonts failed to download'; exit 1; fi  && \
        echo "SERVER_ADDITIONAL_ERL_ARGS=\"+S 1:1\"" | tee -a /etc/rabbitmq/rabbitmq-env.conf && \
        sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf && \
        sed 's|\(application\/zip.*\)|\1\n    application\/wasm wasm;|' -i /etc/nginx/mime.types && \
        pg_conftool $PG_VERSION main set listen_addresses 'localhost' && \
        service postgresql restart && \
        sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE;" && \
        sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" && \
        sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE $ONLYOFFICE_VALUE TO $ONLYOFFICE_VALUE;" && \ 
        service postgresql stop && \
        service redis-server stop && \
        service rabbitmq-server stop && \
        service supervisor stop && \
        service nginx stop && \
        rm -rf /var/lib/apt/lists/*
    
    COPY config /app/ds/setup/config/
    COPY run-document-server.sh /app/ds/run-document-server.sh

EXPOSE 80 443

ARG COMPANY_NAME=onlyoffice
ARG PRODUCT_NAME=documentserver
ARG PACKAGE_URL="http://download.onlyoffice.com/install/documentserver/linux/${COMPANY_NAME}-${PRODUCT_NAME}_amd64.deb"

ENV COMPANY_NAME=$COMPANY_NAME \
    PRODUCT_NAME=$PRODUCT_NAME

RUN wget -q -P /tmp "$PACKAGE_URL" && \
    apt-get -y update && \
    service postgresql start && \
    apt-get -yq install /tmp/$(basename "$PACKAGE_URL") && \
    service postgresql stop && \
    service supervisor stop && \
    chmod 755 /app/ds/*.sh && \
    rm -f /tmp/$(basename "$PACKAGE_URL") && \
    rm -rf /var/log/$COMPANY_NAME && \
    rm -rf /var/lib/apt/lists/*

VOLUME /var/log/$COMPANY_NAME /var/lib/$COMPANY_NAME /var/www/$COMPANY_NAME/Data /var/lib/postgresql /var/lib/rabbitmq /var/lib/redis /usr/share/fonts/truetype/custom

ENTRYPOINT ["/app/ds/run-document-server.sh"]

钻孔安装日志:

docker-compose up -d
Creating network "docker-documentserver_default" with the default driver
Creating volume "docker-documentserver_postgresql_data" with default driver
Pulling onlyoffice-rabbitmq (rabbitmq:)...
latest: Pulling from library/rabbitmq
d5fd17ec1767: Already exists
921d0bdeed9f: Pull complete
ffce2faba222: Pull complete
9b507bebfd9c: Pull complete
789518776d97: Pull complete
fdc5e6a90731: Pull complete
f703023f15bd: Pull complete
858b7223a344: Pull complete
df8ec9fdae09: Pull complete
Digest: sha256:c14cd855625a3fab10e24abcd0511d1c62c411c66f16b9beb92b3477f3ebcb95
Status: Downloaded newer image for rabbitmq:latest
Pulling onlyoffice-postgresql (postgres:9.5)...
9.5: Pulling from library/postgres
fa1690ae9228: Pull complete
a73f6e07b158: Pull complete
973a0c44ddba: Pull complete
07e5342b01d4: Pull complete
578aad0862c9: Pull complete
a0b157088f7a: Pull complete
6c9046f06fc5: Pull complete
ae19407bdc48: Pull complete
e53b7c20aa96: Pull complete
a135edcc0831: Pull complete
fed07b1b1b94: Pull complete
18d9026fcfbd: Pull complete
4d2d5fae97d9: Pull complete
d419466e642d: Pull complete
Digest: sha256:75ebf479151a8fd77bf2fed46ef76ce8d518c23264734c48f2d1de42b4eb40ae
Status: Downloaded newer image for postgres:9.5
Building onlyoffice-documentserver
Step 1/15 : FROM ubuntu:20.04
20.04: Pulling from library/ubuntu
d5fd17ec1767: Already exists
Digest: sha256:47f14534bda344d9fe6ffd6effb95eefe579f4be0d508b7445cf77f61a0e5724
Status: Downloaded newer image for ubuntu:20.04
 ---> 53df61775e88
Step 2/15 : LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
 ---> Running in 23bc8d147d67
Removing intermediate container 23bc8d147d67
 ---> d256ca65fcbd
Step 3/15 : ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive PG_VERSION=12
 ---> Running in de846cb9b6ab
Removing intermediate container de846cb9b6ab
 ---> 57fd532b8b95
Step 4/15 : ARG ONLYOFFICE_VALUE=onlyoffice
 ---> Running in d920bae77f3b
Removing intermediate container d920bae77f3b
 ---> 4650e5fce102
Step 5/15 : RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d &&     apt-get -y update &&     apt-get -yq install wget apt-transport-https gnupg locales &&     mkdir -p $HOME/.gnupg &&     gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/onlyoffice.gpg --keyserver keyserver.ubuntu.com --recv-keys 0x8320ca65cb2de8e5 &&     chmod 644 /etc/apt/trusted.gpg.d/onlyoffice.gpg &&     locale-gen en_US.UTF-8 &&     echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections &&     apt-get -yq install         adduser         apt-utils         bomstrip         certbot         curl         gconf-service         htop         libasound2         libboost-regex-dev         libcairo2         libcurl3-gnutls         libcurl4         libgtk-3-0         libnspr4         libnss3         libstdc++6         libxml2         libxss1         libxtst6         mysql-client         nano         net-tools         netcat-openbsd         nginx-extras         postgresql         postgresql-client         pwgen         rabbitmq-server         redis-server         software-properties-common         sudo         supervisor         ttf-mscorefonts-installer         xvfb         zlib1g &&     if [  $(ls -l /usr/share/fonts/truetype/msttcorefonts | wc -l) -ne 61 ];         then echo 'msttcorefonts failed to download'; exit 1; fi  &&     echo "SERVER_ADDITIONAL_ERL_ARGS=\"+S 1:1\"" | tee -a /etc/rabbitmq/rabbitmq-env.conf &&     sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf &&     sed 's|\(application\/zip.*\)|\1\n    application\/wasm wasm;|' -i /etc/nginx/mime.types &&     pg_conftool $PG_VERSION main set listen_addresses 'localhost' &&     service postgresql restart &&     sudo -u postgres psql -c "CREATE DATABASE $ONLYOFFICE_VALUE;" &&     sudo -u postgres psql -c "CREATE USER $ONLYOFFICE_VALUE WITH password '$ONLYOFFICE_VALUE';" &&     sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE $ONLYOFFICE_VALUE TO $ONLYOFFICE_VALUE;" &&     service postgresql stop &&     service redis-server stop &&     service rabbitmq-server stop &&     service supervisor stop &&     service nginx stop &&     rm -rf /var/lib/apt/lists/*
 ---> Running in 521985bcc74a
ERROR: Service 'onlyoffice-documentserver' failed to build : failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown

先谢了。

oxalkeyp

oxalkeyp1#

如果在Windows计算机上运行shell脚本时遇到问题,可以尝试以下步骤来解决问题:
1.使用dos2unix命令将文件格式转换为UNIX样式。这可以通过在终端中运行以下命令来完成:dos2unix your-file.sh如果您无法访问Linux系统,您可以使用Git Bash for Windows,它附带了一个dos2unix.exe命令。
1.在Git Bash终端运行docker compose命令,这将确保脚本在正确的环境中执行。
请参见tutorialHow to fix “exec user process caused „no such file or directory“” in Docker

相关问题