Docker Community Forums

Share and learn in the Docker community.

Where is the configuration file of config.v2.json within WSL?

docker container ls -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5d07a21be50c pytorch/pytorch:1.8.1-cuda10.2-cudnn7-runtime “/bin/bash” 3 days ago Exited (0) 18 hours ago strange_kepler

As the output, I have a container with id like “5d07a21be50c*”, Actually I can find its config.v2.json in my Windows explorer in this directory
\\wsl.localhost\docker-desktop-data\version-pack-data\community\docker\containers

But I’ve been looking for it for two days and I can’t find this folder within my WSL. I just find some irrelevant container-id directory in /var/lib/docker/containers, like this:

drwx-----x 4 root root 4096 Jul 7 21:54 0a260ea93abc9f577a4e17694a4d258a4d04f5319c433b1ae0ac9b66b79b250e/
drwx-----x 4 root root 4096 Jul 8 01:07 25cdb4bf3a7bb769213de5c5430ec934358630ff85cdc4e55d7263d9a061acba/
drwx-----x 4 root root 4096 Jul 7 20:54 71a1e2a474aecf9b2835cfee49e4dd13fe24c9eb3b243d303d9827ed83b49dbf/
drwx-----x 4 root root 4096 Jul 8 02:37 7351b401c938c8abd7b9dcf73bb7eff78e7162dd618d12c6a1becbb9a3a79cda/
drwx-----x 4 root root 4096 Jul 7 21:54 7e4935b91e364db3b9b6fa6ff672a6f372a5f9e5ad2f2a2728ff02c2448a62d6/
drwx-----x 4 root root 4096 Jul 7 21:55 98d17f7a16a59096eb50dd10f157a2372258d695a79a2203813765f22d72c049/
drwx-----x 4 root root 4096 Jul 7 18:37 ca241e829817fb3800582c03b81413de2cab4fda09fc8e74e8ba02b59a980dea/
drwx-----x 4 root root 4096 Jul 7 20:55 df180fded764000f37554ef3e98402581f061103b895036efe188e446ac20a5e/
drwx-----x 4 root root 4096 Jul 7 22:04 f4d98ece7ac65e5ee0579ccadd48551fbdc83f6c7814a3a546fc48f9df43b5e9/

What something I have missed???

1 Like

May I ask why you look for those files?

On a linux system, the container data for all existing container can be found with find /var/lib/docker/containers -name config.v2.json.

All container ids you get from docker container ps --all --no-trunc --format '{{.ID}} -> {{.Names}}' should be available in /var/lib/docker/containers/' as well. This should be regardless wether the container is running or in exited state.

Odd that your exited container is listed in docker container ls -a (which returns the same output as docker container ps -a), but is not listed in /var/lib/docker/containers/

update: do I get this right, that this allows to customize the configuration for an existing container and e.g. change portmappings, volumes, environment for rescue operations. Didn’t knew this is possible at all and frankly it feels like something that should be used as last resort. For normal day2day operation I would strongly recommend to stick to docker-compose.yml files and perform changes within the file and apply them.

Of course, I know I can find it in /var/lib/docker/containers in the normal linux system. Actually I have mentioned this directory in my question. But I cannot find it within my WSL.

May I ask why you look for those files?

I want to edit it to change some setting for some containers that already exist. Such as add an extra bind-mount directory into the exist containers.

Yep, that’s why I mention find. The find command should work for wls as well. Of course you will want to start from / instead of /var/lib/docker/containers to find the files.

I searched all night last night and did not find it. That’s why I came here for help. If you have a real WSL and you find it. Then I would very much like to know where it is, and how to find it.

I am not sure how you searched the whole night, but this command will find every file called config.v2.json that exists in the wsl container: sudo find / -name config.v2.json

It should be a matter of minutes to get the result. Either it finds the file in one or more locations, or it simply doesn’t exist for container in wsl (which I can not image is the case).

Yes, I have find it by find / -name config.v2.json indeed, but I find nothing. So I think it not in the WSL system. But why I can find it in \\wsl.localhost\docker-desktop-data\version-pack-data\community\docker\containers in my Windows explorer??? And how should I can access it within WSL. This is a confusing question.

1 Like