How do I find my hadoop cluster run from docker? - docker

I am trying to do an experiment to test different runtimes of algorithms using Hadoop with 3 nodes and pig installed. I found a docker image (fluddeni/hadoop-pig) that meets these needs and seemingly is running when checked with docker ps, but I can't find it on any of my ports. I am running my code on Windows and when I check where other docker images run (the docker-machine ip) on the port 9000, as indicated in my core-site.xml file I am getting no page found. Any ideas on where to find the master page for hadoop? Let me know if you need any more information!
Resources:
/usr/local/hadoop/etc/hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://3b85d55c5080:9000</value>
</property>
</configuration>
command docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b85d55c5080 fluddeni/hadoop-pig "/etc/bootstrap.sh -…" 19 hours ago Up 2 seconds 2122/tcp, 8020/tcp, 8030-8033/tcp, 8040/tcp, 8042/tcp, 8088/tcp, 9000/tcp, 10020/tcp, 19888/tcp, 49707/tcp, 50010/tcp, 50020/tcp, 50070/tcp, 50075/tcp, 50090/tcp boring_ptolemy

did you expose the port as you expect?
docker run -p 9000:9000 <rest image details>
reference:
Publish or expose port (-p, --expose)

While port forwarding is one problem, another is the fact that that container ID is not consistent. You should use Docker service DNS names
Ideally, using Compose network bridges.
Then you would always refer to hdfs://namenode:9000, for example

Related

Jenkins Docker plugin volume/mount what syntax to use

I have a linux vm on which I installed docker. I have several docker containers with the different programs I have to use. Here's my architecture:
Everything is working fine except for the red box.
What I am trying to do is to dynamically provide a jenkins docker-in-docker agent with the cloud functionality in order to build my docker images and push them to the docker registry I set up.
I have been looking for documentation to create a docker in docker container and I found this:
https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/
This article states that in order to avoid problems with my main docker installation I have to create a volume:
-v /var/run/docker.sock:/var/run/docker.sock
I tested my image locally and I have no problem to run
docker run -d -v --name test /var/run/docker.sock:/var/run/docker.sock
docker exec -it test /bin/bash
docker run hello-world
The container is using the linux vm docker installation to build and run the docker images so everything is fine.
However, I face problems when it comes to the jenkins docker cloud configuration.
From what I gather, since the #826 build, the docker jenkins plugin has change its syntax for volumes.
This is the configuration I tried:
And the error message I have when trying to launch the agent:
Reason: Template provisioning failed.
com.github.dockerjava.api.exception.BadRequestException: {"message":"create
/var/run/docker.sock: \"/var/run/docker.sock\" includes invalid characters for a local
volume name, only \"[a-zA-Z0-9][a-zA-Z0-9_.-]\" are allowed. If you intended to pass a
host directory, use absolute path"}
I also tried that configuration:
Reason: Template provisioning failed.
com.github.dockerjava.api.exception.BadRequestException: {"message":"invalid mount config for type \"volume\": invalid mount path: './var/run/docker.sock' mount path must be absolute"}
I do not get what that means as on my linux vm the docker.sock absolute path is /var/run/docker.sock, and it is the same path inside the docker in docker I ran locally...
I tried to check the source code to find what I did wrong but it's unclear what the code is doing for me (https://github.com/jenkinsci/docker-plugin/blob/master/src/main/java/com/nirima/jenkins/plugins/docker/DockerTemplateBase.java, from row 884 onward), I also tried with backslashes, etc. Nothing worked.
Has anyone any idea what is the expected syntax in that configuration panel for setting up a simple volume?
Change the configuration to this:
type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock
it is not a volume, it is a bind type.
This worked for me
type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup,readonly

resolve.conf can't be changed - docker-alpine

What am I trying to achieve:
I'm starting 2 containers on 2 different instances in AWS.
I also have a route53 local domain to hold the records of these instances.
When I ping from 'web' instance to 'db' instance I use "ping db.domain.local" and cannot use only "ping db" (and vice versa).
What I did so far:
Changed the file /etc/resolv.conf from
search domain.local
nameserver 127.0.0.11
options ndots:0
to (changed the "options")
search domain.local
nameserver 127.0.0.11
options ndots:1
What I got:
Got it to work.
Error I got:
When I try to change the /etc/resolv.conf file in the Dockerfile or the docker-compose process I get the error
can't move '/etc/resolv.confOobcMn' to '/etc/resolv.conf': Resource busy.
Workaround for now:
Don't have one because I'm trying to get it to work with the Dockerfile build or the docker-compose up process
My infrastructure is:
Containers OS: Alpine Linux 3.4 based
Docker: 18.09.2
Docker-Compose: 1.23.2
Host OS: ubuntu \ MacOS
Apparently changing the docker command in the systemd unit file works.
All you have to do is to add --dns-opt=ndots:15 to the ExecStart line inside /lib/systemd/system/docker.service (depending on your distro) as one of the arguments to the command line and restart docker.
As suggested at the following issue on github.
You cannot overwrite the resolv.conf in a docker container. Docker does some interesting things with resolv.conf to get a lot of their internal networking (GWBridge, Overlays) working.
You may want to try using their --dns-opt=OPTIONS flag when starting the container, or updating your docker-compose to handle the dns flags:
https://docs.docker.com/v17.09/engine/userguide/networking/default_network/configure-dns/

Error in running Spark on Mesos in docker

I have two nodes with docker. Zookeeper,Mesos and Spark were installed on each docker. I specify "slaves" on "slaves" file that I have just one master and one slave. Also, I have a "docker-compose.yaml" on each node in the same path. I do "docker-compose up" in each node. Then in the master node,inside docker,I run dispatcher:
"/home/spark/sbin/start-mesos-dispatcher.sh --master
mesos://150.20.11.136:5050".
After that I run my program with this command:
"/home/spark/bin/spark-submit --name test_mesos --master
mesos://150.20.11.136:5050 --executor-cores 4 --executor-memory 6G --
files iran2.npy --py-files a.zip myprogram.py".
When running my program, I get this error:
Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
I have searched a lot. I disable firewall, first time it worked;but now I does not work at all. Moreover, I openned all port in docker via "expose" in docker compose file. I decreased resources in Submit command. But none of them solved my problem.
Would you please tell me what I am doing wrong?
Any help would be appreciated.
Thanks in advance.
I ran docker with this command and my program was run without any errors. But it took a lot of time, I do not know maybe it is because of Mesos.
Sudo docker run --network host -it ubuntu_mesos_spark_python3.6_oraclient
I hope this point solved others problem.

Docker getting started 3 - Docker Compose unable to connect - connection refused

I am following the Docker Getting Started Tutorials and I am stuck at part 3 (Docker Compose). I am operating on a fresh Ubuntu 16.04 installation. Following the tutorial from part 1 and part 2, except logging in to a Docker account and pushing the newly created image to a remote repository.
The Docker image file and python file are the same as in part 2, and the .yml file is the same as part 3 (I copy-pasted them with vim).
I can deploy a stack with docker compose apparently fine. However, when getting to the part where I am supposed to send a request via curl, I get the following response
curl: (7) Failed to connect to localhost port 80: Connection refused
This is the output of docker service ls right after returning from docker stack deploy:
ID NAME MODE REPLICAS IMAGE PORTS
m3ux2u3i6cpv getstartedlab_web replicated 1/5 username/repo:tag *:80->80/tcp
This is the output of docker container ls (fired right after docker service ls):
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bd870fcb64f4 username/repo:tag "python app.py" 7 seconds ago Up 1 second 80/tcp getstartedlab_web.2.p9v9p34kztmu8rvht3ndg2xtb
db73404d495f username/repo:tag "python app.py" 7 seconds ago Up 1 second 80/tcp getstartedlab_web.1.z3o2t10oiidtzofsonv9cwcvd
While docker ps returns no lines.
And this is the output of docker network ls:
NETWORK ID NAME DRIVER SCOPE
5776b070996c bridge bridge local
47549d9b2e88 docker_gwbridge bridge local
59xa0454g133 getstartedlab_webnet overlay swarm
e27f62ede27d host host local
ramvt1h8ueg7 ingress overlay swarm
f0fe862c5dcc none null local
I can still run the image as a single container and get the expected result, i.e. being able to connect to it via browser or curl and get an error message related to Redis, but I do not understand why it doesn't work when I deploy a stack.
As far as Ubuntu firewall settings are concerned, I have tinkered with none since the installation, and as for Docker and Docker Compose, I have only followed the steps in the "getting started" tutorials in chapters 1-to-3, including downloading Docker Compose binaries and changing permissions with chmod as described. I also added my user to the Docker group so I don't have to sudo every time I need to run a command. I am not behind a proxy server (I am running all tests in local) and I haven't tinkered with any defaults either.
I think this may be a duplicate of this question, though it hasn't been answered nor commented on yet. It is not a duplicate of this question, as I am following a different tutorial.
UPDATE:
As it was, I was using EXACTLY the same docker-compose.yml file. The key issue was a name mismatch with the docker image name, as is visible in the docker service ls output. I thank Janshair Khan for the inspiration. What is strange is for there to be a username/repo image created apparently 9 months ago:
REPOSITORY TAG IMAGE ID CREATED SIZE
<my getting-started image>
python 2.7-slim 4fd30fc83117 7 weeks ago 138MB
hello-world latest f2a91732366c 2 months ago 1.85kB
username/repo <none> c7f5ee4d4030 9 months ago 182MB

docker container port format does not looks right(like <port>-<port>)

I am applying docker.
After docker commit, I command docker ps -a it shows port with following format
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fe593ddcd74f test-container:0.1 "/usr/sbin/init" 3 minutes ago Up 2 minutes 9800-9801/tcp, 9809/tcp elegant_wozniak
to clear my point, 9800-9801/tcp, 9809/tcp part looks strange.
In my experience, It should something like 9800/tcp, 9801/tcp, 9809/tcp.
How can I fix this problem? (Or at least, change -p option of image?)
Thanks.
FYI, I have searched /var/lib/docker/containers/[containerID] folder, but it seems nothing wrong. follow is result of grep 9800
{"StreamConfig":{},"State":{"Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"RemovalInProgress":false,"Dead":false,"Pid":237602,"ExitCode":0,"Error":"","StartedAt":"2017-04-26T04:52:09.543683449Z","FinishedAt":"0001-01-01T00:00:00Z","Health":null},"ID":"fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a","Created":"2017-04-26T04:52:07.968623795Z","Managed":false,"Path":"/usr/sbin/init","Args":[],"Config":{"Hostname":"fe593ddcd74f","Domainname":"","User":"","AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"ExposedPorts":{"9800/tcp":{},"9801/tcp":{},"9809/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","JAVA_HOME=/etc/alternatives/java_sdk_1.8.0"],"Cmd":["/usr/sbin/init"],"ArgsEscaped":true,"Image":"test-container:0.1","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{"build-date":"20170406","license":"GPLv2","name":"CentOS Base Image","vendor":"CentOS"}},"Image":"sha256:9961609c375cbf4db292f34b4beab2db26e968f9cecec149049849cd9758ea9a","NetworkSettings":{"Bridge":"","SandboxID":"6ded0e0aaa4efdf7a094fd02329cd51f44bafdc5700b31453b490a38b3ee4c61","HairpinMode":false,"LinkLocalIPv6Address":"","LinkLocalIPv6PrefixLen":0,"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"ca0bdc7bd4c80b9f31e722f2818072ef7710e8989b11f89fb4e39491511af0f1","EndpointID":"d273747e15b5648bda1728e8b9b57dbdb9a05aa3fa96a559d70e483432f7d455","Gateway":"172.17.0.1","IPAddress":"172.17.0.10","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:0a","IPAMOperational":false}},"Service":null,"Ports":{"9800/tcp":null,"9801/tcp":null,"9809/tcp":null},"SandboxKey":"/var/run/docker/netns/6ded0e0aaa4e","SecondaryIPAddresses":null,"SecondaryIPv6Addresses":null,"IsAnonymousEndpoint":true,"HasSwarmEndpoint":false},"LogPath":"/var/lib/docker/containers/fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a/fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a-json.log","Name":"/elegant_wozniak","Driver":"devicemapper","MountLabel":"","ProcessLabel":"","RestartCount":0,"HasBeenStartedBefore":true,"HasBeenManuallyStopped":false,"MountPoints":{},"SecretReferences":null,"AppArmorProfile":"","HostnamePath":"/var/lib/docker/containers/fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a/hostname","HostsPath":"/var/lib/docker/containers/fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a/hosts","ShmPath":"/var/lib/docker/containers/fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a/shm","ResolvConfPath":"/var/lib/docker/containers/fe593ddcd74f53707af8341151c5be471145d5c6f72a2a06731e9c297beb490a/resolv.conf","SeccompProfile":"","NoNewPrivileges":false}
As stated in this section of the docs for the docker ps command:
'docker ps groups exposed ports into a single range if possible. E.g., a
container that exposes TCP ports 100, 101, 102 displays 100-102/tcp in the
PORTS column.'
Anyway, the reason I posted this was when I access to 9800 port externally. The browser says connection refused.
Before change display like 9800-9801, it works.
And this is the way that I detour this problem.
docker commit <current_container_name> <new_image_name>
docker run -p 9800:9800 --name=<name you want> <new_image_name>.
now you can see something like 0.0.0.0:9800->9800/tcp, 9801/tcp, 9809/tcp(not exactly since I am re-install my docker at this moment)

Resources