Arm based (mac) - hermanumrao/docker-hadoop GitHub Wiki
Steps List all images present on your PC with docker images, and then remove all versions of hadoop images with docker rmi IMAGE_NAME to avoid confusion. Pull the required image based on your CPU architecture. This is very important, because some Macs use Intel chips too.
ARM-based (Mac M series)
docker pull silicoflare/hadoop:arm
It will take a significant amount of time to pull the image, as it is 7.4 GB in size. Make sure you have a proper network connection.(and make sure you dont use restricted wifi connections like my college's (PESU))
Once the image is completely pulled, add an alias to it to refer to it with an easier name. Replace CPU in the command below with amd or arm, like you chose above.
docker tag silicoflare/hadoop:arm hadoop
The image is now ready to be used.
Create a new container out of the image using the run command. Replace ANYNAME in 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 init to 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 ~/.bashrc
to see all changes.
Using an already created container
If you already have a container that you used in the previous session, just type
docker start -ai CONTAINER_NAME bash
to 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 -a''' to 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