在github动作yml文件中创建一个Minio(S3)容器 [英] Creating a Minio(S3) container inside a github actions yml file
问题描述
我正在尝试创建一个Minio / S3容器,以便可以将我的测试套件作为对github的操作来运行。我目前有以下内容:
I am trying to create an Minio/S3 container so I can run my test suite as an action on github. I currently have the following:
name: Run Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-18.04
services:
postgres:
...
minio:
image: minio/minio
volumes:
- /data
ports:
- 9000:9000
env:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio123
options: --entrypoint "minio server /data" --health-cmd "curl -f http://localhost:9000/minio/health/live" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
...
我尝试了以下排列以使minio容器正常工作,但没有成功:
I have tried the following permutations to get the minio container to work but with no success:
volumes:
- ./data:/data
volumes:
- ./:/data
volumes:
- .:/data
volumes:
- /data:/data
我什至尝试过:
options: --entrypoint "mkdir /data; minio server /data" ...
options: --entrypoint "minio server /tmp" ...
options: --entrypoint ["minio server", "/tmp"] ...
而且我尝试使用 -v
标志在-entrypoint
之前装入卷
And I have tried using the -v
flag to mount volumes before the --entrypoint
flag.
options: -v /s3_data:/data --entrypoint "minio server /data" ...
options: -v ${{ github.workspace }}/s3_data:/data --entrypoint "minio server /data" ...
options: -v ${{ github.workspace }}/s3_data:/data:rw --entrypoint "minio server /data" ...
试图使其正常工作。但是不幸的是,我得到:
In an attempt to get it to work. But unfortunately I get:
starting container process caused: exec: "minio server /data": stat minio server /data: no such file or directory: unknown
我无法运行 minio服务器
没有任何参数:(
And I can't run the minio server
without any argument :(
推荐答案
错误提示-入口点 minio服务器/数据 ,而不是
卷
配置。它似乎正在寻找名为 minio服务器/ data的文件
而不是在shell中执行命令。这是很好的解释 -entrypoint
标志的工作原理,原因是因为-entrypoint
需要一个文件(二进制文件或脚本)来执行,而不是带有参数的命令来运行,这似乎很难克服。如此处所示
The error is complaining about the --entrypoint "minio server /data"
, not about the volumes
configuration. It seems to be looking for a file called minio server /data
rather than executing the command in a shell. Here's a good explanation of how --entrypoint
flag works, the reason is because --entrypoint
requires a file (either a binary file or a script) to execute and not the command with arguments to run. It appears that this is quite difficult to overcome as seen here as well.
我唯一想到的建议是在 minio / minio
Docker映像之上构建参数设置为 Dockerfile
并将其上传到DockerHub,以便您可以将其用作 image
镜像。
The only suggestion I would think of is to build on top of the minio/minio
Docker image with the arguments set in the Dockerfile
and upload it to DockerHub so you could use it as the image
instead.
以下是示例 Dockerfile
,您可以使用:
Below is a sample Dockerfile
you could use:
FROM minio/minio
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh", "minio", "server", "/data"]
这篇关于在github动作yml文件中创建一个Minio(S3)容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!