- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
Using the Docker image
Whether you pulled the image or built it yourselves, follow these steps to use it.
- Create a new container out of the image using the run command. Replace ANYNAMEin the command below with any name that you can remember, preferably your SRN.
docker run -it -p 9870:9870 -p 8088:8088 -p 9864:9864 --name ANYNAME hadoop- 
The container is created and you're faced with a prompt that looks like this: root@6aaa78189146:/#.
- 
Now, type initto initialize everything. You will be asked to enter a PC name. Enter whatever you like. Next, choose a color for your prompt and press Enter. The script stops all processes, formats namenodes, starts all processes and shows the number, which is ideally 7 or 8.
- 
Enter source ~/.bashrcto see all changes.
- If you already have a container that you used in the previous session, just type
docker start -ai CONTAINER_NAME bashto start the container and open a terminal. Replace CONTAINER_NAME with the actual name of the container.
- 
If you happen to forget the name of the container, just type docker ps -ato show names of all containers on your PC.
- 
If you want to open another terminal in an already started container, type 
docker exec -it CONTAINER_NAME bash- 
unable to find hadoop:latest locally
 You did not add an alias to the image that you pulled from Docker Hub. Check the Pulling a prebuilt Docker image page to fix it.
- 
port is already allocated
 There is already another container running. Find it out usingdocker ps, and stop it usingdocker stop CONTAINER_NAME.
- You cannot create two containers with the same name. If you want to reuse the name, delete the old container with docker rm CONTAINER_NAMEand create a new container.