Mongodb 无法通过ssh在ubuntu docker容器内运行mongod(docker是使用--net=host启动的)

Mongodb 无法通过ssh在ubuntu docker容器内运行mongod(docker是使用--net=host启动的),mongodb,ubuntu,ssh,docker,ubuntu-14.04,Mongodb,Ubuntu,Ssh,Docker,Ubuntu 14.04,我参考了许多链接来解决此错误严重:全局初始化失败:BadValue无效或没有用户区域设置。请确保正确设置了LANG和/或LC_*环境变量。 我执行了导出LC\u ALL=C 如下面的链接所述 我还提到 并做了以下步骤, root@product:/# localedef -i en_US -f UTF-8 en_US.UTF-8 root@product:/# export LANGUAGE=en_US.UTF-8 root@product:/# export LANG=en_US.UTF-

我参考了许多链接来解决此错误
严重:全局初始化失败:BadValue无效或没有用户区域设置。请确保正确设置了LANG和/或LC_*环境变量。

我执行了
导出LC\u ALL=C
如下面的链接所述

我还提到

并做了以下步骤,

root@product:/# localedef -i en_US -f UTF-8 en_US.UTF-8
root@product:/# export LANGUAGE=en_US.UTF-8
root@product:/# export LANG=en_US.UTF-8
root@product:/# export LC_ALL=en_US.UTF-8
root@product:/# locale-gen en_US.UTF-8
Generating locales...
  en_US.UTF-8... done
Generation complete.
root@product:/# dpkg-reconfigure locales
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.
在尝试了以上所有步骤之后,当我通过ssh执行mongo命令时,仍然会出现以下错误

product@product:~/docker$ sshpass -p password ssh root@172.20.71.71 'mongod --dbpath /var/lib/mongodb/ &'
2015-02-24T09:50:27.158+0000 SEVERE: Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.
但是当我在它工作的容器中执行
mongod--dbpath/var/lib/mongodb/&
时,下面是终端输出

root@product:/# mongod --dbpath /var/lib/mongodb/ &
[1] 284
root@product:/# 2015-02-24T09:56:42.108+0000 [initandlisten] MongoDB starting : pid=284 port=27017 dbpath=/var/lib/mongodb/ 64-bit host=product
2015-02-24T09:56:42.108+0000 [initandlisten] db version v2.6.7
2015-02-24T09:56:42.108+0000 [initandlisten] git version: a7d57ad27c382de82e9cb93bf983a80fd9ac9899
2015-02-24T09:56:42.108+0000 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2015-02-24T09:56:42.108+0000 [initandlisten] allocator: tcmalloc
2015-02-24T09:56:42.108+0000 [initandlisten] options: { storage: { dbPath: "/var/lib/mongodb/" } }

如果有人知道为什么会发生这种情况,我想通过ssh运行它。

可能您的ssh客户端正在尝试在远程主机中设置这些环境变量。编辑您的注释行
SendEnv LANG LC.*
您可以发布来自
sshpass-p密码ssh的结果吗root@172.20.71.71“echo$LANGUAGE”
空行是我运行命令时得到的响应。这就是我正在运行的=”product@product:~/docker$sshpass-p密码sshroot@172.20.71.71“echo$语言”