As I know, docker doesn't support any command that change port mapping after make container. But this answer said that by changing the hostconfig.json file, I can change port mapping.
How do I assign a port mapping to an existing Docker container? I'm using docker desktop in windows + WSL2.So path of hostconfig.json is different with other answers. Where is hostconfig.json? In my case, (wsl$docker-desktop-datamntwsldocker-desktop-datadata, /var/lib/docker(in wsl)) directories are not exist.
1.4m articles
1.4m replys
5 comments
57.0k users