Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请求帮助,想使用docker compose创建但是报错。 #46

Closed
lhbdhr opened this issue Dec 3, 2022 · 9 comments
Closed

请求帮助,想使用docker compose创建但是报错。 #46

lhbdhr opened this issue Dec 3, 2022 · 9 comments

Comments

@lhbdhr
Copy link

lhbdhr commented Dec 3, 2022

使用docker run可以运行,但compose可以修改端口等配置信息,很方便,所以还是想用compose,但是报错。

# docker run -d --name v2ray -v $PWD/config.json:/etc/v2fly/config.json -v $PWD/ca:/etc/v2fly/ca -p 443:443 v2fly/v2fly-core run -c /etc/v2fly/config.json
# docker-compose.yaml

version: '3.9'

services:
  v2ray:
    image: v2fly/v2fly-core
    container_name: v2ray
    restart: unless-stopped
    ports:
      - '443:443'
    volumes:
      - $PWD/config.json:/etc/v2fly/config.json
      - $PWD/ca:/etc/v2fly/ca/
      - $PWD/logs:/etc/v2fly/logs/
    command:
      - /usr/bin/v2ray run -c /etc/v2fly/config.json
{
  "log": {
    "loglevel": "error",
    "access": "/etc/v2fly/logs/access.log",
    "error": "/etc/v2fly/logs/error.log"
  },
  "inbounds": [
    {
      "port": 443,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "xxxxxxxxxxxx",
            "level": 0,
            "alterId": 0,
            "email": "love@v2fly.com"
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "tls",
        "tlsSettings": {
          "certificates": [
            {
              "certificateFile": "/etc/v2fly/ca/server.cer",
              "keyFile": "/etc/v2fly/ca/server.key"
            }
          ]
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

container 不能正常启动。
docker logs 报错信息:

v2ray /usr/bin/v2ray run -c /etc/v2fly/config.json: unknown command
Run 'v2ray help /usr/bin/v2ray run -c' for usage.

尝试过修改command,v2ray help都不能正常打印。

@kslr
Copy link
Contributor

kslr commented Dec 4, 2022

/usr/bin/v2ray run -c /etc/v2fly/config.json
run -c /etc/v2fly/config.json

@lhbdhr
Copy link
Author

lhbdhr commented Dec 4, 2022

/usr/bin/v2ray run -c /etc/v2fly/config.json
run -c /etc/v2fly/config.json

command修改成run -c /etc/v2fly/config.json吗?
尝试过了,不行。

v2ray run -c /etc/v2fly/config.json: unknown command
Run 'v2ray help run -c' for usage.
# command里无论填写什么 都会有个v2ray打头,然后提示  unknown command
例如:
command:
      - ls
# 提示
v2ray ls: unknown command
Run 'v2ray help' for usage.

@kslr
Copy link
Contributor

kslr commented Dec 4, 2022

v2 镜像拉的是最新的马

@lhbdhr
Copy link
Author

lhbdhr commented Dec 4, 2022

是最新的呀,昨天全新机器,刚pull的

@Hzend
Copy link

Hzend commented Dec 7, 2022

修改一下docker-compose.yml文件

    command:
      - /usr/bin/v2ray run -c /etc/v2fly/config.json

修改为

    command: run -c your_config_path/config.json

@lhbdhr
Copy link
Author

lhbdhr commented Dec 7, 2022

修改一下docker-compose.yml文件

    command:
      - /usr/bin/v2ray run -c /etc/v2fly/config.json

修改为

    command: run -c your_config_path/config.json

牛的,可以了,这是什么原理啊?

@lhbdhr
Copy link
Author

lhbdhr commented Dec 7, 2022

问题已解决!感谢各位。

@lhbdhr lhbdhr closed this as completed Dec 7, 2022
@JacksonRGB
Copy link

JacksonRGB commented Mar 9, 2023

我今天也遇到了 unknown command,按照上面修改还是不行

proxy | v2ray run -c /etc/v2ray/config.json: unknown command
proxy | Run 'v2ray help run -c' for usage.

container_name: proxy
image: v2fly/v2fly-core:v5.1.0
volumes:
  - $PWD/v2ray-config.json:/etc/v2ray/config.json
command:
  - "run -c /etc/v2ray/config.json"

@lhbdhr
Copy link
Author

lhbdhr commented Mar 9, 2023

我今天也遇到了 unknown command,按照上面修改还是不行

proxy | v2ray run -c /etc/v2ray/config.json: unknown command proxy | Run 'v2ray help run -c' for usage.

container_name: proxy
image: v2fly/v2fly-core:v5.1.0
volumes:
  - $PWD/v2ray-config.json:/etc/v2ray/config.json
command:
  - "run -c /etc/v2ray/config.json"

修改成这样,命令语句 和 command 必须在一行,而且别加双引号。

 command: run -c /etc/v2fly/config.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants