환경
도커 볼륨
gajy
2022. 6. 8. 11:22
728x90
도커가 제공하는 볼륨 관리 기능
경로: /var/lib/docker/volumes/${volume-name}/_data
$ docker volume create --name sunju_volume
# 경로: /var/lib/docker/volumes/sunju_volume
$ docker volume ls
DRIVER VOLUME NAME
local sunju_volume
$ docker run -d \
--name sunju-mysql \
-e MYSQL_DATABASE=sunju \
-e MYSQL_ROOT_PASSWORD=sunju \
-v sunju_volume:/var/lib/mysql \
-p 3306:3306 \
mysql:5.7
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
954d09af6f01 mysql:5.7 "docker-entrypoint.s…" 4 seconds ago Up 3 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp sunju-mysql
$ ls -al /var/lib/docker/volumes/sunju_volume/_data
total 188492
drwxrwxrwt 6 systemd-coredump systemd-coredump 4096 6월 8 11:20 .
drwxr-xr-x 3 root root 4096 6월 8 11:12 ..
-rw-r----- 1 systemd-coredump systemd-coredump 56 6월 8 11:20 auto.cnf
-rw------- 1 systemd-coredump systemd-coredump 1680 6월 8 11:20 ca-key.pem
-rw-r--r-- 1 systemd-coredump systemd-coredump 1112 6월 8 11:20 ca.pem
-rw-r--r-- 1 systemd-coredump systemd-coredump 1112 6월 8 11:20 client-cert.pem
-rw------- 1 systemd-coredump systemd-coredump 1680 6월 8 11:20 client-key.pem
-rw-r----- 1 systemd-coredump systemd-coredump 1352 6월 8 11:20 ib_buffer_pool
-rw-r----- 1 systemd-coredump systemd-coredump 79691776 6월 8 11:20 ibdata1
-rw-r----- 1 systemd-coredump systemd-coredump 50331648 6월 8 11:20 ib_logfile0
-rw-r----- 1 systemd-coredump systemd-coredump 50331648 6월 8 11:20 ib_logfile1
-rw-r----- 1 systemd-coredump systemd-coredump 12582912 6월 8 11:20 ibtmp1
drwxr-x--- 2 systemd-coredump systemd-coredump 4096 6월 8 11:20 mysql
drwxr-x--- 2 systemd-coredump systemd-coredump 4096 6월 8 11:20 performance_schema
-rw------- 1 systemd-coredump systemd-coredump 1676 6월 8 11:20 private_key.pem
-rw-r--r-- 1 systemd-coredump systemd-coredump 452 6월 8 11:20 public_key.pem
-rw-r--r-- 1 systemd-coredump systemd-coredump 1112 6월 8 11:20 server-cert.pem
-rw------- 1 systemd-coredump systemd-coredump 1676 6월 8 11:20 server-key.pem
drwxr-x--- 2 systemd-coredump systemd-coredump 4096 6월 8 11:20 sunju
drwxr-x--- 2 systemd-coredump systemd-coredump 12288 6월 8 11:20 sys
* 참고: fastcampus 'Kubernetes와 Docker로 한 번에 끝내는 컨테이너 기반 MSA' 강의
728x90