Service not available error using python to create neo4j docker image

Hello and thanks in advance.

I’m a newbie making my way through an ETL course (approx. 2 years old ) and I believe I’m having some configuration struggles on a neo4j section. I did post this in the newbie board but with no takers wondered if it belonged here.

Current scenario:

Using Python3 code to create a neo4j docker image, populates the db, and open a local server to query the db with a separate client script - but I have yet to get to the client part.

I have:
Windows 10 Machine
Docker Desktop (Docker Engine v20.10.5)
Neo4j Desktop 1.4.3

As suggested I'm running a virtiual env using:
Pyhton 3.8
py -m neo4j 4.2.1
py -m neobolt 1.7.17

When I run the code to create Neo4j Docker image/db and server end point I get the following error:

"raise ServiceUnavailable("Failed to establish connection to {!r} (reason {})".format(resolved_address, error))

neo4j.exceptions.ServiceUnavailable: Failed to establish connection to IPv4Address(('', 7687)) (reason [WinError 10061] No connection could be made because the target machine actively refused it):"

I’ve tried using community version (not as win service) but had Java trouble, and making a bolt port firewall rule with no luck. My newbie brain thinks this may have to do with the note below from the neo4j documentation. I am not sure how to test this, change in neo4j db config, or implement in the python code.

"Using Docker on Windows will also need a couple of additional configurations because the default address that is resolved with the above command does not translate to localhost in Windows. We can add the following environment variables to our command above to set the advertised addresses:"

I have searched far and wide trying to solve this but I have not been able to. If anyone can suggest a direction, candidate or help in any way that would be appreciated.

It's been a while since I looked at docker but when I have setup virtual machines with virtual box sometimes you have to map the logical ports to prevent clashes. So you may need to map :7687 to another port to solve this.
netstat is a very usefull tool here it will thell you what ports are open.
Hope this helps.

Thanks and I'll try this. Appreciate the reply.