check data

killed container

$ docker volume ls | grep ssd-fw-SC- | head -1
local     5b2e5ca2d4563199cc3a982e74c3f4613a7a1b4a1d91bb948561d5a6a1cf4cfa

$ docker inspect 5b2e5ca2d4563199cc3a982e74c3f4613a7a1b4a1d91bb948561d5a6a1cf4cfa | jq -r .[].Mountpoint
/var/lib/docker/volumes/5b2e5ca2d4563199cc3a982e74c3f4613a7a1b4a1d91bb948561d5a6a1cf4cfa/_data

stopped container

$ docker ps -a --format '{{.ID}}'
77745046363d

$ docker inspect $(docker ps -a --format '{{.ID}}' | head -1) | jq -r '.[].Mounts[] | select(.Mode == "rw") | .Source'
/var/lib/docker/volumes/ssd-fw-DESKTOP-KUUJPNF-LAB-p0-18558e0fe2640d50617587518acfe1fc5a10d3e2077a62d26509b679832f3fd1/_data

$ sudo ls -Altrh $(docker inspect $(docker ps -a --format '{{.ID}}' | head -1) | jq -r '.[].Mounts[] | select(.Mode == "rw") | .Source')

mount

mount exists volume to new container

# $1: exists volume need to be visit
# $2: new volume for new container

$ docker volume create --name $2
$ docker run --rm \
             -i \
             -t \
             -v $1:/from \
             -v $2:/to \
             alpine ash -c "cd /from ; cp -av . /to"
Copyright © marslo 2020-2024 all right reserved,powered by GitbookLast Modified: 2024-10-30 04:30:30

results matching ""

    No results matching ""