You can run Hadoop in Docker container.
Follow the below steps one by one
$ yum install docker-ce
$ systemctl start docker
$ docker load -i -t centos:latest
$ docker run -it --name mydvd -v (copy the path of java folder):/dvd1 -v (copy the path of hadoop folder:/dvd2 centos:latest
Now you can find your java and hadoop folder in docker image as dvd1 and dvd2.
Now, install java and set all the environment variables in .bashrc file.
Hope this will help you