我想从CloudRun连接Filestore,我已经在运行节点应用程序和装载的run.sh脚本中定义了它命令连接到文件存储,我的节点应用程序在云上运行,但无法装载到文件存储中,我有附加了一个链接到我的nodejs代码,也在我的脚本中,在node命令之后没有其他命令运行。我正在关注谷歌官方文档。
我的运行脚本出现问题:
node /app/index.js //working on cloudrun
mkdir -p $MNT_DIR //not working on cloudrun
chmod 775 $MNT_DIR //not working on cloudrun
echo "Mounting Cloud Filestore." //not working on cloudrun
mount --verbose -t nfs -o vers=3 -o nolock 10.67.157.122:/filestore_vol1/test/testing/ $MNT_DIR //not working
echo "Mounting completed." //not working on cloudrun
注意:-如果我把node/app/index.js放在echo之后"安装完成"/节点应用程序未在cloudrun 上启动
我在这里附上我的代码URL。
我的Docker文件:
FROM node:slim
# Install system dependencies
RUN apt-get update -y && apt-get install -y
tini
nfs-common
procps
&& apt-get clean
# Set working directory
WORKDIR /app
# Set fallback mount directory
ENV MNT_DIR /app2
# Copy package.json to the working directory
COPY package*.json ./
# Copy all codes to the working directory
COPY . .
# Ensure the script is executable
RUN chmod +x /app/run.sh
# Use tini to manage zombie processes and signal forwarding
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
ENV PORT=8080
EXPOSE 8080
EXPOSE 2049
# Pass the startup script as arguments to tini
CMD ["/app/run.sh"]
# My run.sh script file
#!/bin/bash
set -eo pipefail
node /app/index.js
# Create mount directory for service.
mkdir -p $MNT_DIR
chmod 775 $MNT_DIR
echo "Mounting Cloud Filestore."
mount --verbose -t nfs -o vers=3 -o nolock 10.x.x.122:/filestore_vol1/test/testing/ $MNT_DIR
echo "Mounting completed."
# Exit immediately when one of the background processes terminate.
wait -n
#main goal is to mount cloud run with filestore and start my node app
我也花了两天的时间。在我的案例中,容器中缺少一个依赖项。试试这条线而不是
RUN apt-get update -y && apt-get install -y
tini
nfs-common
netbase
procps
&& apt-get clean
Netbase解决了我的问题。如果这也是你的情况,请告诉我!