I am trying to start a docker container with the below command.
docker run -it -p 50070:50070 -p 8088:8088 -p 8080:8080 suhothayan/hadoop-spark-pig-hive:2.9.2 bash
It ended up with the following error.
docker: error response from daemon: Ports are not available: listen tcp 0.0.0.0/50070: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
As I understand, the error has occurred as the port 50070 is used by another process. I've tried to identify the process in order to kill that with the below command in the command prompt, but it does not give an output nor an error.
netstat -ano | findstr :50080
As per Docker issue for windows https://github.com/docker/for-win/issues/3171 :
You might have that port in any of the excluded port ranges of command
netsh interface ipv4 show excludedportrange protocol=tcp
You can use solution mentioned in the above ticket.
Disable hyper-v (which will required a couple of restarts)
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
After finishing all the required restarts, reserve the port you want so hyper-v doesn't reserve it back
netsh int ipv4 add excludedportrange protocol=tcp startport=50070 numberofports=1
Re-Enable hyper-V (which will require a couple of restart)
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All