Setup docker for Hackthebox machine

I tried to find a way to setup docker container for HTB machine, but I got problems with some of the lab that requires access from web browser. Is there a way to access those web server from my local computer?

I am kinda confused on what you are trying to do. Are you trying to run a virtual machine inside a docker container? Are you running trying to set up Docker on a virtual machine? Are you running a docker container on A virtual machine but for some reason using a web browser in the docker container to interact with the website?

Personally, I suggest running a HTB OS on a virtual machine either on you local machine through virtual box, kvm, VMware or using AWS.

I am using MacOS and I do not want to create VM, even though it might be a more popular solution. I created docker container using Kali linux image, and set up VPN inside that container.
From inside the container, I can access the lab server. However, I want to access to server from a browser outside container, such as Safari on MacOS. That’s why I am asking whether I can access from browser, maybe with container port forwarding, but I have not found it yet

You can set up a SOCKS tunnel to your Kali docker container (with ssh) and use this proxy from your macOS browser to access HTB machines.