0

几天来,我一直在 Red Hat Enterprise Linux 8.2 (LVM) - Gen2 上使用 podman 作为 Docker 替代方案。

我正在尝试安装 LogStash、OpenSearch 和 OpenSearch Dashboards,过去我在 Docker 桌面(操作系统:Win10/WSL2:Kali Linux)上成功安装了它。

看来我无法通过 RHEL 8.2 上的 dockerfile,在那里我提取了以下图像:

podman images
REPOSITORY                                                               TAG             IMAGE ID       CREATED       SIZE
docker.io/opensearchstaging/opensearch-dashboards                        latest          cf658f6cf7d9   2 days ago    588 MB
docker.io/opensearchstaging/opensearch                                   latest          2553f12f3288   2 days ago    821 MB
docker.io/opensearchstaging/opensearch-dashboards                        1.2.0-testfix   92f6fd764cd2   8 days ago    1.03 GB
docker.io/opensearchstaging/opensearch                                   1.2.4-testfix   4978cb93486d   8 days ago    861 MB
docker.io/opensearchproject/logstash-oss-with-opensearch-output-plugin   latest          a54746f23cbc   7 weeks ago   1.07 GB

我成功运行了 opensearchpodman run -it -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" docker.io/opensearchstaging/opensearch:1.2.4-testfix并写了一个 YML 名称docker-compose.yml

version: '3'
services:
  opensearch-node1:
    image: docker.io/opensearchstaging/opensearch:1.2.4-testfix
    container_name: opensearch-node1
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node1
      - discovery.seed_hosts=opensearch-node1,opensearch-node2
      - cluster.initial_master_nodes=opensearch-node1,opensearch-node2
      - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
      - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536 # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems
        hard: 65536
    volumes:
      - opensearch-data1:/usr/share/opensearch/data
    ports:
      - 9200:9200
      - 9600:9600 # required for Performance Analyzer
    networks:
      - opensearch-net
  opensearch-node2:
    image: docker.io/opensearchstaging/opensearch:1.2.4-testfix
    container_name: opensearch-node2
    environment:
      - cluster.name=opensearch-cluster
      - node.name=opensearch-node2
      - discovery.seed_hosts=opensearch-node1,opensearch-node2
      - cluster.initial_master_nodes=opensearch-node1,opensearch-node2
      - bootstrap.memory_lock=true
      - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - opensearch-data2:/usr/share/opensearch/data
    networks:
      - opensearch-net
  opensearch-dashboards:
    image: docker.io/opensearchstaging/opensearch-dashboards:1.2.0-testfix
    container_name: opensearch-dashboards
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]' # must be a string with no spaces when specified as an environment variable
    networks:
      - opensearch-net

volumes:
  opensearch-data1:
  opensearch-data2:

networks:
  opensearch-net:

我安装了 python 3 库podman-compose,但是当我运行它时遇到了很多错误podman compose up,我最终认为我必须这样做export PATH="$PATH:~/.local/bin:/usr/local/bin"才能使用podman-compose

这样做之后,我跑了 podman-compose up,结果如下:

['podman', '--version', '']
using podman version: 1.6.4
Traceback (most recent call last):
  File "/usr/local/bin/podman-compose", line 11, in <module>
    load_entry_point('podman-compose==1.0.3', 'console_scripts', 'podman-compose')()
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1885, in main
    podman_compose.run()
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1078, in run
    self._parse_compose_file()
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1122, in _parse_compose_file
    raise RuntimeError("Project name [{}] normalized to empty".format(dir_basename))
RuntimeError: Project name [] normalized to empty

所以我用 定义了一个项目名称opensearch-dashboardspodman-compose -p opensearch-dashboards up但我得到了另一个错误堆栈跟踪:

['podman', '--version', '']
using podman version: 1.6.4
{'opensearch-net'} {'opensearch-net'}
** excluding:  set()
podman volume inspect opensearch-dashboards_opensearch-data1 || podman volume create opensearch-dashboards_opensearch-data1
['podman', 'volume', 'inspect', 'opensearch-dashboards_opensearch-data1']
['podman', 'network', 'exists', 'opensearch-dashboards_opensearch-net']
Error: unrecognized command `podman network exists`
Try 'podman network --help' for more information.
['podman', 'network', 'create', '--label', 'io.podman.compose.project=opensearch-dashboards', '--label', 'com.docker.compose.project=opensearch-dashboards', 'opensearch-dashboards_opensearch-net']
Error: unknown flag: --label
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 581, in assert_cnt_nets
    try: compose.podman.output([], "network", ["exists", net_name])
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 877, in output
    return subprocess.check_output(cmd_ls)
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['podman', 'network', 'exists', 'opensearch-dashboards_opensearch-net']' returned non-zero exit status 125.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/podman-compose", line 11, in <module>
    load_entry_point('podman-compose==1.0.3', 'console_scripts', 'podman-compose')()
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1885, in main
    podman_compose.run()
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1080, in run
    cmd(self, args)
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1317, in wrapped
    return func(*args, **kw)
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 1491, in compose_up
    podman_args = container_to_args(compose, cnt, detached=args.detach)
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 700, in container_to_args
    assert_cnt_nets(compose, cnt)
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 610, in assert_cnt_nets
    compose.podman.output([], "network", args)
  File "/usr/local/lib/python3.6/site-packages/podman_compose.py", line 877, in output
    return subprocess.check_output(cmd_ls)
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['podman', 'network', 'create', '--label', 'io.podman.compose.project=opensearch-dashboards', '--label', 'com.docker.compose.project=opensearch-dashboards', 'opensearch-dashboards_opensearch-net']' returned non-zero exit status 125.

老实说,我不知道。

4

0 回答 0