如何检测Docker守护程序端口 [英] How to detect a docker daemon port

查看:151
本文介绍了如何检测Docker守护程序端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了Ubuntu和Docker。我正在尝试启动Raik容器:

I have installed Ubuntu and Docker. I am trying to launch Raik container:

$ DOCKER_RIAK_AUTOMATIC_CLUSTERING=1 DOCKER_RAIK_CLUSTER_SIZE=5 DOCKER_RIAK_BACKEND=leveldb make start-cluster ./bin/start

并收到错误消息:


似乎未设置环境变量DOCKER_HOST。
除非已正确设置
,否则无法启动Riak群集。例如:

It looks like the environment variable DOCKER_HOST has not been set. The Riak cluster cannot be started unless this has been set appropriately. For example:

export DOCKER_HOST = tcp://127.0.0.1:2375

export DOCKER_HOST="tcp://127.0.0.1:2375"

如果我设置了

export DOCKER_HOST="tcp://127.0.0.1:2375"

我所有其他容器都停止工作,并说找不到Docker守护进程。

all my other containers stop working and said, that can not find the Docker daemon.

似乎我的Docker damon使用的不是2375端口。如何检查它?

It looks like my Docker damon use other than 2375 port. How can I check it ?

推荐答案

默认情况下,docker守护进程将使用unix套接字 unix: /// var / run / docker.sock (您可以通过执行 sudo netstat -tunlp 来检查这种情况,并注意没有docker daemon进程在任何端口上侦听)。建议出于安全原因保留此设置,但听起来Riak要求守护程序在TCP套接字上运行。

By default, the docker daemon will use the unix socket unix:///var/run/docker.sock (you can check this is the case for you by doing a sudo netstat -tunlp and note that there is no docker daemon process listening on any ports). It's recommended to keep this setting for security reasons but it sounds like Riak requires the daemon to be running on a TCP socket.

要使用带有以下命令的TCP套接字启动docker守护程序任何人都可以连接,使用 -H 选项:

To start the docker daemon with a TCP socket that anybody can connect to, use the -H option:

sudo docker -H 0.0.0.0:2375 -d &

警告:这意味着可以通过该TCP与守护程序通信的机器套接字可以访问您的主机。

Warning: This means machines that can talk to the daemon through that TCP socket can get root access to your host machine.

相关文档:

http://basho.com/posts/technical/running-riak-in-docker/

https://docs.docker.com/install/linux/linux-postinstall/#configure-where-the-docker-daemon-listens-for-connections

这篇关于如何检测Docker守护程序端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆