如何从另一个Docker容器运行Mecab

时间:2020-08-15 13:55:19

标签: docker-compose mecab

我创建了以下docker-compose文件

version: '3'
services:
  mecab:
    #entrypoint: ["sh", "-c", "sleep 2073600"]
    image: wgtdocker/mecab-0.996-alpin3.12:latest
    volumes:
      - mecab-volume:/usr/local/bin
      - tmp-volume:/tmp
    links:
      - web
  
  web:
    entrypoint: ["sh", "-c", "sleep 2073600"]
    build: ./
    volumes:
      - mecab-volume:/usr/local/bin
      - tmp-volume:/tmp
volumes:
  mecab-volume:
  tmp-volume:

并运行docker-compose up --build -d

     Name                    Command               State    Ports
-----------------------------------------------------------------
vagrant_mecab_1   mecab -d /usr/local/lib/me ...   Exit 0        
vagrant_web_1     sh -c sleep 2073600              Up            

并运行docker-compose exec web sh 并运行ls -lt / tmp

/go # ls -lt /tmp
total 8
drwxrwxr-x    9 root     root          4096 Aug 15 12:24 mecab-ipadic-neologd-0.0.6
drwxr-xr-x    8 11152    5000          4096 Aug 15 12:23 mecab-0.996

并运行ls -lt / usr / local / bin / mecab

/go # ls -lt /usr/local/bin/mecab
-rwxr-xr-x    1 root     root         19800 Aug 15 10:45 /usr/local/bin/me-cab

所以我运行了mecab --help,但是此应用程序无法正常工作并出现以下错误

Error loading shared library libmecab.so.2: No such file or directory (needed by /usr/local/bin/mecab)
Error relocating /usr/local/bin/mecab: mecab_do: symbol not found

在运行后找到/ -name libmecab.so.2

/go # find / -name libmecab.so.2
/tmp/mecab-0.996/src/.libs/libmecab.so.2

我应该再次安装mecab吗? 但我想不重新安装即可解决问题

如果您有什么想法让我知道

0 个答案:

没有答案