Get the App
SLTechnology News&Howtos  ›  Servers  › 

[docker] docker data management

Shulou Source: shulou.com Published: 2022-06-02 06:48:20 10月03日 Update

1. Data volumes (bypass ufs layer, take effect immediately, and can be shared and reused)

-v /data

-v src:dst

docker run -it --name volume-test1 -h nginx -v /data centos

-it: keep it open, start tty

--name volume-test1:docker name is volume-test1

-h nginx: Specify host name as nginx

-v /data: Create a data volume

Find where container data is written:

docker inspect -f {{.Volumes}} volume-test1

Hang on to physical host directory to docker

docker run -it --name volume-test2 -h nginx -v /opt1:/opt2 centos

-v Source directory: Destination directory

Hang opt1 of the physical server in the opt2 directory of the docker container

Tags: Data directory host container physical name server source directory target service data management management Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Information OPPO Reno Shulou Technology Docker