Cloudera Docker image - not able to access Hue & Cloudera manager - cloudera

I've installed Cloudera Docker on Mac (referred link - https://blog.cloudera.com/blog/2015/12/docker-is-the-new-quickstart-option-for-apache-hadoop-and-cloudera/)
Command used for starting Cloudera Docker image ->
docker run --privileged=true --hostname=quickstart.cloudera -t -i <image_hash> /usr/bin/docker-quickstart -p 80:80 -p 8888:8888 -p 7180:7180
I've re-started Hue (successfully) using command :
service hue start
Also, i started Cloudera Manager (successfully), using command :
/home/cloudera/cloudera-manager --express --force
However, when i try to access Cloudera Manager or Hue using UI, it doesnt show up
(url cannot be found)
urls i tried :
http://localhost:7180
http://localhost:8888
http://quickstart.cloudera:7180
http://quickstart.cloudera:8888
what do i need to do to access this ?
Also, i was trying to check if there is any other port is allocated by dockers
command ->
docker port quizzical_kowalevski // quizzical_kowalevski - name of the container
This shows up nothing :(
Pls note - This is on my local m/c (Mac)
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b2d26270435 4239cd2958c6 "/usr/bin/docker-qui…" 3 minutes ago Up 3 minutes sharp_bohr
Error logs (for hue) :
[29/Nov/2018 01:42:20 ] supervisor ERROR Exception in supervisor main loop
Traceback (most recent call last):
File "/usr/lib/hue/desktop/core/src/desktop/supervisor.py", line 386, in main
wait_loop(sups, options)
File "/usr/lib/hue/desktop/core/src/desktop/supervisor.py", line 396, in wait_loop
time.sleep(1)
File "/usr/lib/hue/desktop/core/src/desktop/supervisor.py", line 218, in sig_handler
raise SystemExit("Signal %d received. Exiting" % signum)
SystemExit: Signal 15 received. Exiting

As per your input, the docker run command is malformed.
You shouldn't add additional switches (in this case port mapping switches) after the image identification and command to start the containerized application. All additional arguments will be passed as arguments of the containerized application (i.e: to /usr/bin/docker-quickstart instead of being taken up by the docker engine to configure the port mapping)
Your output of docker ps show that you have no port mapping definition because of this.
You can read more about docker run command here. The general form of the docker run command is:
$ docker run [OPTIONS] IMAGE[:TAG|#DIGEST] [COMMAND] [ARG...]
You should change the order of your switches to something like this:
docker run --hostname=quickstart.cloudera --restart unless-stopped --privileged=true -dti -p 8888:8888 -p 80:80 -p 7180:7180 cloudera/quickstart /usr/bin/docker-quickstart

Related

How to properly start nginx in Docker

I want nginx in a Docker container to host a simple static hello world html website. I want to simply start it with "docker run imagename". In order to do that I added the run parameters to the Dockerfile. The reason I want to do that is that I would like to host the application on Cloud Foundry in a next step. Unfortunately I get the following error when doing it like this.
Dockerfile
FROM nginx:alpine
COPY . /usr/share/nginx/html
EXPOSE 5000
CMD ["nginx -d -p 5000:5000"]
Error
Error starting userland proxy: Bind for 0.0.0.0:5000: unexpected error Permission denied.
From ::
https://docs.docker.com/engine/reference/builder/#expose
EXPOSE does not make the ports of the container accessible to the host. To do that, you must use either the -p flag to publish a range of ports or the -P flag to publish all of the exposed ports. You can expose one port number and publish it externally under another number
CMD ["nginx -d -p 5000:5000"]
You add your dockerfile
FROM nginx:alpine
its already starts nginx.
after you build from your dockerfile
you should use this on
docker run -d -p 5000:5000 <your_image>
Edit:
If you want to use docker port 80 -> machine port 5000
docker run -d -p 5000:80 <your_image>

My docker container isn't starting on localhost (0.0.0.0) on Docker for Windows (Native using Hyper-V)

I'm following Digital Ocean's tutorial on how to start a nginx docker container (Currently on Step 4). Currently this is their output:
$ docker run --name docker-nginx -p 80:80 -d nginx
d3ccb73a91985651ec61231bca9f9c716f0dec807e354a29eeef2144f883a01c
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b91f3ce26553 nginx "nginx -g 'daemon off" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 443/tcp docker-nginx
But when I run it, this is my output (noticed the different IP of the container):
C:\>docker run --name docker-nginx -p 80:80 -d nginx
d3ccb73a91985651ec61231bca9f9c716f0dec807e354a29eeef2144f883a01c
C:\>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d3ccb73a9198 nginx "nginx -g 'daemon off" 14 hours ago Up 2 seconds 10.0.75.2:80->80/tcp, 443/tcp docker-nginx
Why does this happen? And how can I get the same results as Digital Ocean's? (Getting the server to start on localhost)
Edit: I'm using Docker for windows (recently released) which apparently runs native using Hyper-V. My output for docker-machine ls is this:
C:\>docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
C:\>
But when I run it, this is my output (noticed the different IP of the
container)
Since this a Windows machine, I assume that you're using Docker Toolbox Docker for Windows. 10.0.75.2 is the IP of the boot2docker virtual machine.
If you are using Windows or Mac OS, you will need some form of virtualization in
order to run Docker. The IP you just saw is the IP of that lightweight virtual machine.
And how can I get the same results as Digital Ocean's? (Getting the
server to start on localhost)
Use a Linux distribution! Also you can enable Expose container ports on localhost in Docker For Windows Settings:
Despite you created the containers in your local machine. These are actually running on a different machine (a virtual machine)
First, check what is the IP of your docker machine (the virtual machine)
$docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
default * virtualbox Running tcp://192.168.99.100
Then run curl command (or open a browser) to view the default web site on your nginx web server inside the container
curl http://192.168.99.100:80
if you are using a virtual machine on windows:
docker-machine ip default
https://docs.docker.com/machine/concepts/
When I ran this command for the first time: docker run -d -p 80:80 --name docker-tutorial docker101tutorial
I got this error:
docker: Error response from daemon: Conflict. The container name
"/docker-tutorial" is already in use by container "LONG_CONTAINER_ID".
You have to remove (or rename) that container to be able to reuse that
name.
so, I tried to remove this container using: docker rm -f LONG_CONTAINER_ID
then I did: docker run -d -p 3080:80 --name docker-tutorial docker101tutorial
note 3080:80 instead of 80:80... Had I run this from the docker desktop, I would see this default option below:

Docker run results in "host not found in upstream" error

I have a frontend-only web application hosted in Docker. The backend already exists but it has "custom IP" address, so I had to update my local /etc/hosts file to access it. So, from my local machine I am able to access the backend API without problem.
But the problem is that Docker somehow can not resolve this "custom IP", even when the host in written in the container (image?) /etc/hosts file.
When the Docker container starts up I see this error
$ docker run media-saturn:dev
2016/05/11 07:26:46 [emerg] 1#1: host not found in upstream "my-server-address.com" in /etc/nginx/sites/ms.dev.my-company.com:36
nginx: [emerg] host not found in upstream "my-server-address.com" in /etc/nginx/sites/ms.dev.my-company.com:36
I update the /etc/hosts file via command in Dockerfile, like this
# install wget
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*
# The trick is to add the hostname on the same line as you use it, otherwise the hosts file will get reset, since every RUN command starts a new intermediate container
# it has to be https otherwise authentification is required
RUN echo "123.45.123.45 my-server-address.com" >> /etc/hosts && wget https://my-server-address.com
When I ssh into the machine to check the current content of /etc/hosts, the line "123.45.123.45 my-server-address.com" is indeed there.
Can anyone help me out with this? I am Docker newbee.
I have solved this. There are two things at play.
One is how it works locally and the other is how it works in Docker Cloud.
Local workflow
cd into root of project, where Dockerfile is located
build image: docker build -t media-saturn:dev .
run the builded image: docker run -it --add-host="my-server-address.com:123.45.123.45" -p 80:80 media-saturn:dev
Docker cloud workflow
Add extra_host directive to your Stackfile, like this
and then click Redeploy in Docker cloud, so that changes take effect
extra_hosts:
'my-server-address.com:123.45.123.45'
Optimization tip
ignore as many folders as possible to speed up process of sending data to docker deamon
add .dockerignore file
typically you want to add folders like node_modelues, bower_modules and tmp
in my case the tmp contained about 1.3GB of small files, so ignoring it sped up the process significantly

Error when trying to run a meteor app in docker using meteorhacks:meteord

I have just began playing around with docker. While trying out method 1 from meteorhacks:meteord, I get the folowing error
=> You don't have an meteor app to run in this image.
Here is what I have done after creating the basic counter demo meteor app.
docker build -t app .
Sending build context to Docker daemon 11.75 MB
Step 0 : FROM meteorhacks/meteord:base
---> 528baf8d4263
Step 1 : MAINTAINER MeteorHacks Pvt Ltd.
---> Running in 6d7e7eb6ebce
---> d69fefdbeb70
Removing intermediate container 6d7e7eb6ebce
Step 2 : ONBUILD copy ./ /app
---> Running in e68618104dfa
---> c253ae966ea1
Removing intermediate container e68618104dfa
Step 3 : ONBUILD run bash $METEORD_DIR/on_build.sh
---> Running in e51e557c2b05
---> a6a6a1be9147
Removing intermediate container e51e557c2b05
Successfully built a6a6a1be9147
then ( I already initiated a mongo container exposing 27017 and grabbed the internal ip address which was 171.17.0.1)
docker run -d \
-e ROOT_URL=http://localhost:3000 \
-e MONGO_URL=mongodb://172.17.0.1:27017/ \
-e MONGO_OPLOG_URL=mongodb://172.17.0.1:27017/ \
-p 8080:80 \
app
I get the error when I do this and then run docker logs <container id>
Can someone guide me on this?
Thanks in advance.
This error comes from scripts/run_app.sh, which is the ENTRYPOINT of the base Dockerfile.
It checks for the presence of:
/bundle folder, or
/built_app, or
$BUNDLE_URL
If your counter demo Dockerfile didn't populate /bundle or /built_app folders, then you need to make sure you are defining ENV BUNDLE_URL with the right url.

Unable to run docker commands

I am running docker using the command
sudo docker -H 0.0.0.0:2375 -d &
I am then using teh dockerjava client to create images and run containers in the following way
DockerClient dockerClient = DockerClientBuilder.getInstance("http://localhost:2375").build();
l
CreateContainerResponse container = dockerClient.createContainerCmd(image_name)
.exec();
dockerClient.startContainerCmd(container.getId()).exec();
This works fine and the docker logs look fine too. But when I try to use any of the docker commands including docker ps, docker images, docker info, all of them fail with the following error
FATA[0000] Get http:///var/run/docker.sock/v1.18/info: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
Using sud also does not solve the problem. I am running docker on unix. Any thoughts?
Using sudo also does not solve the problem. I am running docker on unix. Any thoughts?
You have started up Docker listening on a TCP socket. This means that when the docker client attempts to connect to the default Unix-domain socket, there's nothing there. The error message is pretty clear about that:
dial unix /var/run/docker.sock: no such file or directory.
You need to tell the docker client where to connect, just like you have to provide that information to the DockerClientBuilder class in your code. You can do this (a) using the -H option to the client or (b) using the DOCKER_HOST environment variable.
For example:
$ docker -H http://localhost:2375 ps
$ docker -H http://localhost:2375 pull alpine
Or:
$ export DOCKER_HOST=http://localhost:2375
$ docker ps
$ docker pull alpine

Resources