Docker User/Group Management

Loading

# Create Service with Volume ( Bind Mount)
docker service create –name myservice –mount type=volume,source=myvolume,target=/mypath nginx

# show volume
docker volume ls

# remove volumes dangling
docker volume prune

# docker volume create 
docker volume create myvolumename

# To create container with a persistent volumes ( Volume Mount – note there is no /myvolume – / refers to Unix dir)

docker run -dt –name ashwebserver -v <volname>:<mapto> <image-name> sh
docker run -dt –name ashwebserver -v myvolume:/etc <image-name> sh
or
docker run -dt –name webserver01 –mount type=volume,source=myvolume,target=/mypath nginx

# To create container with a persistent volumes ( Bind Mounts aka – / )
docker run -dt –name webserver01 –mount type=bind,source=/root/index,target=/mypath nginx
or
docker run -dt –name ashwebserver -v /myvolume:/etc <image-name> sh

docker run -d –name=filebeat –user=root –volume=”/var/lib/docker/containers:/var/lib/docker/containers:ro” –volume=”/var/run/docker.sock:/var/run/docker.sock:ro”
  filebeatimage -e -strict.perms=false -E output.elasticsearch.hosts=[“elasticsearch:9300”] 

/basically determines if this is a volume or bind
docker container run -dt –name mynginx –mount type=bind,source=/root/index,target=/usr/share/nginx/html nginx

(Visited 73 times, 1 visits today)

By C A Thomas

Chinchu A. Thomas is an Infrastructure Analyst specializing in Microsoft Azure, the Microsoft 365 suite, AWS, and Windows infrastructure management products.

Leave a Reply