I'm starting an hdfs server with:
docker run -d sequenceiq/hadoop-docker:2.6.0
I'm observing the running docker processes with
docker ps
Which gets the following result:
6bfa4f2fd3b5 sequenceiq/hadoop-docker:2.6.0 "/etc/bootstrap.sh -d"
31 minutes ago Up 31 minutes 22/tcp, 8030-8033/tcp, 8040/tcp,
8042/tcp, 8088/tcp, 49707/tcp, 50010/tcp, 50020/tcp, 50070/tcp, 50075/tcp,
50090/tcp kind_hawking
I'm trying to connect via hdfs to my docker container with:
sudo docker run -ti davvdg/hdfs-client hadoop fs -fs hdfs://localhost:50075 -ls /
This gives the following resut:
ls: Call From a48f81b8e1bb/172.17.0.3 to localhost:50075 failed on
connection exception: java.net.ConnectException: Connection refused; For
more details see: http://wiki.apache.org/hadoop/ConnectionRefused
My question is: How to get my hdfs docker client running?
Edit:
Thanks to some helpful feedback from #shizhz I'm updating the question.
Here is my Dockerfile
FROM sequenceiq/hadoop-docker:2.6.0
CMD ["/etc/bootstrap.sh", "-d"]
# Hdfs ports
EXPOSE 50010 50020 50070 50075 50090 8020 9000
# Mapred ports
EXPOSE 10020 19888
#Yarn ports
EXPOSE 8030 8031 8032 8033 8040 8042 8088
#Other ports
EXPOSE 49707 2122
EXPOSE 9000
EXPOSE 2022
Here is how I'm building the image:
sudo docker build -t my-hdfs .
Here is how I'm running the image:
sudo docker run -d -p my-hdfs
Here is how I'm checking the processes:
sudo docker ps
with a result like:
d9c9855cfaf0 my-hdfs "/etc/bootstrap.sh -d" 2 minutes ago
Up 2 minutes 0.0.0.0:32801->22/tcp, 0.0.0.0:32800->2022/tcp,
0.0.0.0:32799->2122/tcp, 0.0.0.0:32798->8020/tcp, 0.0.0.0:32797->8030/tcp,
0.0.0.0:32796->8031/tcp, 0.0.0.0:32795->8032/tcp, 0.0.0.0:32794->8033/tcp,
0.0.0.0:32793->8040/tcp, 0.0.0.0:32792->8042/tcp, 0.0.0.0:32791->8088/tcp,
0.0.0.0:32790->9000/tcp, 0.0.0.0:32789->10020/tcp, 0.0.0.0:32788->19888/tcp,
0.0.0.0:32787->49707/tcp, 0.0.0.0:32786->50010/tcp, 0.0.0.0:32785->50020/tcp,
0.0.0.0:32784->50070/tcp, 0.0.0.0:32783->50075/tcp, 0.0.0.0:32782->50090/tcp
agitated_curran
Here is how I'm getting the IP address:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' d9c9855cfaf0
with a result like:
172.17.0.3
Here is how I'm running the test:
sudo docker run --rm sequenceiq/hadoop-docker:2.6.0 /usr/local/hadoop-2.6.0/bin/hadoop fs -fs hdfs://192.168.0.3:9000 -ls /
With a result like:
17/04/08 19:51:54 INFO ipc.Client: Retrying connect to server:
192.168.0.3/192.168.0.3:9000. Already tried 0 time(s); maxRetries=45
ls: Call From fafcd377f4a0/172.17.0.2 to 192.168.0.3:9000 failed on connection
exception: java.net.ConnectException: Connection refused; For more details
see: http://wiki.apache.org/hadoop/ConnectionRefused
My question is: How to get my hdfs docker client running?
By default, each container will use bridge network driver and has its own isolation network environment. It's not the same thing but you can just simply think they are different servers and has their own private IPs. So when you started a client container and try to connect the address hdfs://localhost:50075, it'll actually try to connect the port 50075 of itself, rather than connecting the hadoop server container, obviously it'll be refused. Please refer to their official network docs for more info.
Containers on the same host can communicate with each other by their private IPs, so to connect to your hadoop server container, you can firstly find out it private IP by:
$> docker inspect --format '{{ .NetworkSettings.IPAddress }}' 378
192.168.0.2
And then I can use the client by(And I think the port should be 9000):
$> docker run --rm sequenceiq/hadoop-docker:2.6.0 /usr/local/hadoop-2.6.0/bin/hadoop fs -fs hdfs://192.168.0.2:9000 -ls /
Found 1 items
drwxr-xr-x - root supergroup 0 2015-01-15 04:04 /user
If you want to run client container on another host, then you need to know multi-host networking.
for the client, you could use the thin docker image just for client like hdfs client.
one of them are pretty good that I've used before: https://hub.docker.com/r/ryneyang/hadoop-utils/
Related
I want to have a container that can access and run kubectl command on my host machine. Here is what I have:
I have installed Kubernetes and Minikube on my host machine.
I used this docker container: helm-kubectl link
This is the command I run my docker:
docker run -it -v ~/.kube:/root/.kube -v ~/.minikube:/Users/xxxx/.minikube dtzar/helm-kubectl
Inside the container, when I checked the cluster, I can see the context has loaded my minikube, However, I can't run another kubectl command due to the reason "The connection to the server 127.0.0.1:32768 was refused - did you specify the right host or port?".
bash-5.0# kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
docker-desktop docker-desktop docker-desktop
docker-for-desktop docker-desktop docker-desktop
* minikube minikube minikube
bash-5.0# kubectl get all
The connection to the server 127.0.0.1:32768 was refused - did you specify the right host or port?
I have checked my Kubenetes config at ~/.kube and the port is 32768.
- cluster:
certificate-authority: /Users/xxx/.minikube/ca.crt
server: https://127.0.0.1:32768
name: minikube
I have tried port -p 32768 or --expose 32768 but no luck. So anyone can help this?
Thanks zerkms! It works with --network host
I am using windows10, redis-64bit, I started a redis container with command:
docker run --name myredis -d redis redis-server --appendonly yes
when I try to connect to this container using:
redis-cli -h 192.168.99.1 -p 6379
it shows:
Could not connect to Redis at 192.168.99.1:6379: Unknown error
here, 192.168.99.1 is my virtual machine ip address, anyone know how to solve this issue, thanks!
To connect to a redis container from a remote server you should do the following:
Start redis container on host (192.168.99.1):
docker run --name myredis -p 7000:6379 -d redis redis-server
Connect via remote server:
redis-cli -h 192.168.99.1 -p 7000
After I start memos-master on Ubuntu 14.04, I'm unable to get to http://:5050
therefore I want to verify if Mesos is listening on the default port 5050.
I'm following the instructions here.
vagrant#master2:~$ sudo start mesos-master
mesos-master start/running, process 5272
vagrant#master1:~$ mesos help
Usage: mesos <command> [OPTIONS]
Available commands:
help
start-agents.sh
daemon.sh
stop-masters.sh
start-masters.sh
start-slaves.sh
start-cluster.sh
master
stop-slaves.sh
agent
stop-cluster.sh
stop-agents.sh
log
execute
scp
tail
resolve
ps
init-wrapper
local
cat
I tried this to verify, but no result.
vagrant#master1:~$ sudo netstat -tnlp | grep 5050
I know Mesos is running but I get connection refused.
vagrant#master1:~$ curl http://192.168.2.1:5050
curl: (7) Failed to connect to 192.168.2.1 port 5050: Connection refused
I see you are using Vagrant so go the the browser in the host machine and type <master2_ip>:5050
<master2_ip> - replace it with the IP address of the master2 using ipaddr or ifconfig to find the ip.
If the mesos is up and running you will get the mesos dashboard or else port unreachable error.
Post your vagrantFile here.
Mac running Docker Version 17.12.0-ce-mac55 (23011) here.
I have a very bizarre situation with Docker that I absolutely cannot explain!
I have a Dockerized web service that runs perfectly fine outside of Docker, running off of port 9200 (so: http://localhost:9200)
I can also run several other images locally (nginx, Oracle DB) and I can access them via localhost:80 and localhost:1521 respectively
When I run the container for my Dockerized service, I see (via docker logs <containerId>) the service startup without any errors whatsoever
Despite the fact that the container is running without any errors, I absolutely cannot connect to it from my Mac host via localhost:9200
The exact steps to reproduce are:
Clone this repo
Build the image via ./gradlew clean build && docker build -t locationservice .
Run the container via docker run -it -p 9200:9200 -d --net="host" --name locationservice locationservice
If you use docker ps to obtain the <containerId>, then you can keep hitting docker logs <containerId> until you see it has started up without errors
On my machine, when I try to curl against localhost:9200, I get "connection refused" errors (see below)
curl error is:
curl -X GET http://localhost:9200/bupo
curl: (7) Failed to connect to localhost port 9200: Connection refused
Some things I have ruled out:
localhost is absolutely resolveable from the host because we're running in host network mode and I have no problem connecting to nginx (port 80) and Oracle (port 1521) containers
The app is starting up and if you look at the logs you'll see it is starting up listening on 9200
Any ideas what the problem could be?!
Docker for Mac runs in a VM. --net=host refers to the Linux VM hosts network stack not OSX. There is no direct network path from OSX to the Docker VM other than mapped ports.
Mapped ports (docker run -p Y:N) in Docker for Mac are a little special, in addition to the user space proxy that runs on the Docker host normally, Docker for Mac also launches a user space proxy on OSX to listen on the same port and forward connections into the VM. The OSX process isn't started when using --net=host (and the Linux one isn't either of course).
→ docker run --name nc --rm --net=host -dp 9200:9200 busybox nc -lk -p 9201 -e echo hey
→ docker inspect nc --format '{{ json .NetworkSettings.Ports }}'
{}
→ sudo lsof -Pni | grep 9200
→
Then without --net=host
→ docker run --name nc --rm -dp 9200:9200 busybox nc -lk -p 9201 -e echo hey
→ docker inspect nc --format '{{ json .NetworkSettings.Ports }}'
{"9200/tcp":[{"HostIp":"0.0.0.0","HostPort":"9200"}]}
→ sudo lsof -Pni | grep 9200
vpnkit 42658 matt 28u IPv4 0x57f79853269b81bf 0t0 TCP *:9200 (LISTEN)
vpnkit 42658 matt 29u IPv6 0x57f798532765ca9f 0t0 TCP [::1]:9200 (LISTEN)
If your app requires --net=host then I would use Vagrant/Virtualbox to spin up a VM with a "Host Only" adapter. This means there is a direct network path that you can access from OSX on the VM. Here's the Vagrantfile I use.
Docker for Mac does not support host network mode very well: https://github.com/docker/for-mac/issues/1031
So at this moment the solution is to use default bridge mode.
I've installed Docker on OSX and downloaded the neo image. when I run it (using the args in the home page of the image), everything seems to work, but the last lines of the log indicate something like:
00:20:39.662 [main] INFO org.eclipse.jetty.server.Server - Started
#4761ms 2015-10-05 00:20:39.663+0000 INFO [API] Server started on:
http://022b5f3a38fc:7474/ 2015-10-05 00:20:39.663+0000 INFO [API]
Remote interface ready and available at [http://022b5f3a38fc:7474/]
which seem odd and attempting to connect my browser to either http://localhost:7474/ or the indicated http://022b5f3a38fc:7474/ results in an error
what am I missing here?
You'll want to use the IP address of the docker VM, which you can determine with this command:
docker-machine inspect default | grep IPAddress
The default IP address is 192.168.99.100
So depending on which port you exposed when running the Neo4j docker container you can access the Neo4j browser at:
http://192.168.99.100:7474
or
http://192.168.99.100:8474
Port 8474 is the the binding specified by this command:
docker run -i -t --rm --name neo4j -v $HOME/neo4j-data:/data -p 8474:7474 neo4j/neo4j
which is the example given in the documentation here