dockerpysparkcloudera-quickstart-vm

Running spark in docker showing - site can't be reached


I am new in docker, running a cloudera quickstart in docker using the port 8888.

docker run --hostname=quickstart.cloudera --privileged=true -t -i -p 8888:8888 -p 8800:8800 -p 7180:7180 cloudera/quickstart /usr/bin/docker-quickstart

I need to run another docker container to run spark. Docker command I found is

docker run -d -p 8888:8888 -v $PWD:/home/jovyan/work --name dockerspark jupyter/pyspark-notebook

As I am already using the port 8888, I changed the port as 7777. The command executed without any errors. But when I go to http://localhost:7777, its showing

The site cannot be reached

Is is not possible to change the port? How can I run the spark in docker without affecting my cloudera.

output of 'docker ps'

CONTAINER ID        IMAGE                      COMMAND                  CREATED              STATUS              PORTS                                                                    NAMES
bcfce4ba3bc6        jupyter/pyspark-notebook   "tini -- start-notebo"   About a minute ago   Up About a minute   0.0.0.0:7777->7777/tcp, 8888/tcp                                         dockerspark
a108ac632a6f        cloudera/quickstart        "/usr/bin/docker-quic"   6 days ago           Up 6 days           0.0.0.0:7180->7180/tcp, 0.0.0.0:8800->8800/tcp, 0.0.0.0:8888->8888/tcp   silly_bassi

Solution

  • That is why I wanted to know the command you executed. See the docker ps output below

    0.0.0.0:7777->7777/tcp, 8888/tcp 
    

    You mapped 7777 to 7777 inside. What runs on 7777 inside the container? Nothing. You just needed to change the host port and not the container port

    docker run -d -p 7777:8888 -v $PWD:/home/jovyan/work --name dockerspark jupyter/pyspark-notebook
    

    This should allow your pyspark notebook to be accessible at http://localhost:7777/