-v => stands for volume to map docker and host directory
sudo docker run --name pgadmin -p 80:80 -v /var/lib/pgadmin:/var/lib/pgadmin -e 'PGADMIN_DEFAULT_EMAIL=m.thirumal@hotmail.com' -e 'PGADMIN_DEFAULT_PASSWORD=thirumal' -d dpage/pgadmin4
By default, when a container gets create, it also creates a volume/folder in /var/lib/docker/volumes
and that will get delete when the container removed.
To keep the data persistant, (Create/Bind Volume)
The volume/directory will be created under /var/lib/docker/volumes
docker volume create postgresql_volume
docker volume ls
docker run -d -v postgresql_volume:/var/lib/postgres --name postgres -p 5432:5432 postgres:latest
docker rm -fv {container_id}
The volume which are create with container but not deleted.
To remove all dangling volume
docker volume rm $(docker volume ls -f=dangling=true -q)