Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how-to-use-docker-volumes.md #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docker/scenarios/how-to-use-docker-volumes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# why we use volume in docker containers
# In all containers has own logs if container crashed or exit from any reason the how we can troubleshoot bcz as we knows logs are in container to aviod these things
# we user external volumes so containers log can persists.

To check volumes:
docker volume ls
# volumes are two types
1. Managed by docker called volume
# For Create volume
docker volume create volumename.
# to check volume location or mountion point
docker volume inspect volumename
# We cant attache any volume in running container so we need to create new container with volume
docker run -d -P --mount type=volume,src=volumename,target=/opt/toomcat/logs image:v1
# now if we check mounting point all loged has captureed or stored
# targrt of logs can be different according to application or image build

2. Managed by user called bind volume
# why we need bind volume
# because volume created by dokcer need sudo privladges to access this location to avoide such these conditons we use bind volume
# we will create a dir. in any location wehere we didnt need sudo privladges

mkdir /home/ubuntu/Dlogos
# now only chanages in commad is
type=bind, src=/home/ubuntu/Dlogs
docker run -d -P --mount type=bind,src=/home/ubuntu/Dlogs,target=/opt/toomcat/logs image:v1