Docker Storage commands :-
There are three main ways to manage data in containers:
· Data volumes
· Mount the host directory (bind mounts)
· tmpfs for caching memory
· Data volumes :- Volumes are stored in a part of the host filesystem which is managed by Docker (/var/lib/docker/volumes/ on Linux). Volumes are the best way to persist data in Docker.
· Mount the host directory (bind mounts) :- Bind mounts may be stored anywhere on the host system.
· tmpfs :- tmpfs mounts are stored in the host system’s memory only.
- volume lists.
# docker volume ls
- bind mount.
# docker container run -it -v /home/ubuntu/test:/tmp/test ubuntu:14.04 bash
- create a volume .
# docker volume create <volume_name>
# docker container run -it -v <volume_name>:/tmp/test ubuntu:14.04 bash
- volume details.
# docker volume inspect <volume_name>
- remove volume.
# docker volume rm <volume_name>
6. change to docker home directory:-
# vim /etc/sysconfig/docker-storage
7. Number of files open in container.
#vim /etc/sysconfig/docker
OPTIONS="--default-ulimit nofile=1024:4096"
8. Volume mount other location use local-persist plugin :-
# docker info
Plugins:
Volume: local local-persist
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
# docker volume create -d local-persist -o mountpoint=/mnt/ --name=shashi_extra
# docker container run -it -v shashi_extra:/tmp/test ubuntu:14.04 bash
ref link :- https://unix.stackexchange.com/questions/439106/docker-create-a-persistent-volume-in-a-specific-directory
No comments:
Post a Comment