3

Hello I need to change the ports of a running container (I want to update current container, not creating a new one).

Apparently one way to achieve this is by changing the config.v2.json file for the container in question.

But I am running Docker on a Windows 10 machine, and I cannot find where that file is (on Linux it is on /var/lib/docker/containers/[container-id]/config.v2.json and on Windows it used to be on c:\Programdata\Docker\Containers\[container-id]\config.v2.json but this is not the case anymore).

Anyone knows where to access that file nowadays?
Or maybe there is a better approach to change config params of an existing container? Thanks!

user3621841
  • 815
  • 2
  • 10
  • 18
  • 1
    The correct approach is to delete and recreate the container. You should not be manually editing files in `/var/lib/docker` at all. It’s not obvious to me that changing that JSON file would actually result in any behavior change in Docker. – David Maze Nov 12 '19 at 16:16
  • Look here https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container/63455911#63455911 – rofrol Aug 17 '20 at 17:58
  • Does this answer your question? [How do I assign a port mapping to an existing Docker container?](https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container) – rofrol Aug 17 '20 at 17:58
  • I find all the files under `\docker-desktop-data\version-pack-data\community\docker\containers\` but it's always rebuilt even I modified the content. – Sheldon Wei Dec 24 '21 at 02:33

1 Answers1

3

I found mine here (19.03.13-beta2)

\\wsl$\docker-desktop-data\version-pack-data\community\docker\containers\

For previous versions, it may be here

\\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\docker

To access from within WSL \\wsl$ is /mnt/wsl

Tedy Pranolo
  • 1,285
  • 1
  • 14
  • 22
  • Funny, I can find the director `community` in `version-pack-data` in window explorer, but I cannot find any director within in WSL – yode Jul 10 '21 at 22:52