我正在为我的码头工人文件使用gitlab-runner基本图像
FROM gitlab/gitlab-runner:alpine
WORKDIR /app
RUN touch /etc/gitlab-runner/config.toml # it doesn't work because of drwx------ direcotry
RUN touch /etc/config.toml # it worked because etc is drwxr-xr-x directory
COPY . /app
...
...
ENTRYPOINT ["yarn"]
CMD ["run", "start"]
使用工具检查图像
创建图像时,我在etc/gitlab-runner directory
中看不到config.toml文件
还想知道certs文件夹的用途是什么?它包含什么?实际上,我想将config.toml文件安装到主机上,以便在销毁容器时始终能获得运行程序详细信息。
实际上,我想将config.toml文件挂载到主机上,以便在销毁容器时始终可以同步运行程序详细信息。根据此语句,我想您无需担心创建文件,因为您的意图是将文件从主机装载到容器。在Linux环境上(在您的主机上)。在您的应用程序文件夹中创建一个文件夹,并将其保存为:
mkdir config
touch config.toml
现在将您的docker文件更新为:
FROM gitlab/gitlab-runner:alpine
WORKDIR /app
COPY . .
...
...
ENTRYPOINT ["yarn"]
CMD ["run", "start"]
现在您重建图像并以以下方式启动容器:
docker build -t username/image_name .
docker run -v "absolute path to the folder config":"/etc/gitlab-runner/" username/image_name
现在您应该会看到config.toml
文件已安装到/ etc / gitlab-runner,并且容器运行也没有错误。