Docker Frequently Asked Questions

Can you Assign port mappings to running containers

No, you can’t

You need to recreate the containers

Eg.

docker run -d -p 15672:15672 -p 5672:5672 rabbitmq:3-management

Source: Stackoverflow assign port mappings to exisitng containers

Can you access a docker container directly via it’s internal ip or do you have to bind to the host port

You can, but not on mac.

Inspecting your containers ip will gives its internal ip.

Docker Desktop for Mac can’t route traffic to containers, do you won’t be able to ping or access it.

Weirdly you can nmap that private ip.

Source: Networking features in Docker Desktop for Mac