I checked the contents of docker volume

First, display the list of volumes

list.sh



$ docker volume ls
du667382djcn ・ ・ ・
hy66557738mj ・ ・ ・
examplevolume
examplevolume2

Random numbers like du6673 displayed here Volume may be automatically generated for some reason. When pulling a container, starting, etc. within my own recognition range The line is cut, the mount or the file in the image is directly tampered with, etc. I feel that it often happens for some reason. (If you have any experiences that it will be automatically generated at such times, I would be grateful if you could comment)

Mount the automatically generated volume and set up a test container

run.sh



$ docker run -itd --name testvolume -v du667382djcn:/du667382djcn busybox

As a command structure docker run -itd --name Container name here -v Volume name here: / Freely set the directory name inside the container when attaching a volume inside the container busybox (← image. Busybox is a lightweight Linux command Group image)

It will be shaped like.

Note) Note that an error will occur if the / slash is omitted.

Now to the volume directory in the container

exec.sh



$ docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
a23fd4z8ks2d        busybox             "sh"                8 seconds ago       Up 7 seconds                            testvolume

$ docker exec -it a23fd4z8ks2d /bin/ash
/ # ls -la
total 48
drwxr-xr-x    1 root     root          4096 Apr 10 03:19 .
drwxr-xr-x    1 root     root          4096 Apr 10 03:19 ..
-rwxr-xr-x    1 root     root             0 Apr 10 03:19 .dockerenv
drwxr-xr-x    2 root     root         12288 Jul 16  2019 bin
drwxr-xr-x    5 root     root           360 Apr 10 03:19 dev

drwxr-xr-x    2 root     root          4096 Nov 11 10:03 du667382djcn

drwxr-xr-x    1 root     root          4096 Apr 10 03:19 etc
drwxr-xr-x    2 nobody   nogroup       4096 Jul 16  2019 home
dr-xr-xr-x  190 root     root             0 Apr 10 03:19 proc
drwx------    1 root     root          4096 Apr 10 03:20 root
dr-xr-xr-x   13 root     root             0 Apr 10 03:19 sys
drwxrwxrwt    2 root     root          4096 Jul 16  2019 tmp
drwxr-xr-x    3 root     root          4096 Jul 16  2019 usr
drwxr-xr-x    4 root     root          4096 Jul 16  2019 var

$ls -la /du667382djcn

This will bring up a list of the mounted directories.

Unresolved questions

I tried the following method with reference to the information a while ago, but it didn't work.

error.sh



$ docker volume ls
du667382djcn ・ ・ ・
hy66557738mj ・ ・ ・
examplevolume
examplevolume2

$ docker volume inspect du667382djcn
[
    {
        "CreatedAt": "2017-11-11T10:13:45Z",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/du667382djcn ・ ・ ・/_data",
        "Name": "du667382djcn ・ ・ ・",
        "Options": null,
        "Scope": "local"
    }
]

$ sudo ls -la /var/lib/docker/volumes/du667382djcn ・ ・ ・/_data
ls: /var/lib/docker/volumes/du667382djcn ・ ・ ・/_data: No such file or directory

It would be easier if this method could be done. I would appreciate it if you could comment on any of the above mistakes or similar practices.

Recommended Posts

I checked the contents of docker volume
I checked the options of copyMakeBorder of OpenCV
I checked the list of shortcut keys of Jupyter
I checked the session retention period of django
I checked the processing speed of numpy one-dimensionalization
I checked the output specifications of PyTorch's Bidirectional LSTM
I checked out the versions of Blender and Python
I checked the default OS and shell of docker-machine
Simulation of the contents of the wallet
I searched for the contents of CloudWatch Logs Agent
The day of docker run (note)
I investigated the mechanism of flask-login!
Understand the contents of sklearn's pipeline
See the contents of Kumantic Segumantion
I checked the gift tax amount
I checked the distribution of the number of video views of "Flag-chan!" [Python] [Graph]
I tried to expand the size of the logical volume with LVM
I checked the usage status of the parking lot from satellite images.
I checked the image of Science University on Twitter with Word2Vec.
I tried the asynchronous server of Django 3.0
I summarized the folder structure of Flask
I didn't know the basics of Python
The Python project template I think of.
Read all the contents of proc / [pid]
I read the implementation of golang channel
I checked the number of closed and opened stores nationwide by Corona
I think the limit of knapsack is not the weight but the volume w_11/22update
Get the contents of git diff from python
I tried the pivot table function of pandas
I checked the library for using the Gracenote API
Note: Prepare the environment of CmdStanPy with docker
I tried cluster analysis of the weather map
Prepare the execution environment of Python3 with Docker
I read the implementation of range (Objects / rangeobject.c)
The contents of the Python tutorial (Chapter 5) are itemized.
The contents of the Python tutorial (Chapter 4) are itemized.
The contents of the Python tutorial (Chapter 2) are itemized.
I solved the deepest problem of Hiroshi Yuki.
I was in trouble because the behavior of docker container did not change
The contents of the Python tutorial (Chapter 8) are itemized.
The contents of the Python tutorial (Chapter 1) are itemized.
I tried to touch the API of ebay
The contents of the Python tutorial (Chapter 10) are itemized.
I tried to correct the keystone of the image
Try the free version of Progate [Python I]
About the development contents of machine learning (Example)
I touched some of the new features of Python 3.8 ①
Dump the contents of redis db with lua
Enter into stdin of the running Docker container
The contents of the Python tutorial (Chapter 6) are itemized.
I started Docker
I read and implemented the Variants of UKR
The contents of the Python tutorial (Chapter 3) are itemized.
Contents of __name__
I want to customize the appearance of zabbix
I checked the calendar deleted in Qiita Advent Calendar 2016
I tried using the image filter of OpenCV
Scraping the winning data of Numbers using Docker
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
About the matter that the contents of Python print are not visible in docker logs