Linux

docker volume mount

Naan 2021. 2. 3. 17:12
320x100

docker volume 마운트 방법

-- 우선 볼륨 생성

# docker volume create work

-- 생성 확인

# docker volume ls
DRIVER    VOLUME NAME
local     work

생성 되었고.

 

-- 이미지에 마운트

# docker run -itd --detach -v work:/work --name centos7 --restart always centos:7

 

접속 해보면

# docker exec -it centos7 /bin/bash
[root@cb9bdb58daa1 /]# df
Filesystem                1K-blocks     Used Available Use% Mounted on
overlay                   943793916 89271488 854522428  10% /
tmpfs                         65536        0     65536   0% /dev
tmpfs                       5910180        0   5910180   0% /sys/fs/cgroup
shm                           65536        0     65536   0% /dev/shm
/dev/mapper/centos00-root 943793916 89271488 854522428  10% /work
tmpfs                       5910180        0   5910180   0% /proc/asound
tmpfs                       5910180        0   5910180   0% /proc/acpi
tmpfs                       5910180        0   5910180   0% /proc/scsi
tmpfs                       5910180        0   5910180   0% /sys/firmware

work 에 마운트 된것을 확인 할 수 있다.

320x100