meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:docker [2017/07/14 15:26] – [Volumes] niziaklinux:docker [2020/05/07 09:05] (current) niziak
Line 1: Line 1:
 +====== Docker ======
  
   * **Docker image** - operating system with preconfigured application (service)   * **Docker image** - operating system with preconfigured application (service)
Line 30: Line 31:
 -v, --volume=[]                 Bind mount a volume -v, --volume=[]                 Bind mount a volume
 </code> </code>
 +
 +How to run multiple shell commands in docker at once:
 +<code bash>docker run image /bin/bash -c "cd /some/path && some_command"</code>
  
  
Line 76: Line 80:
   * https://github.com/ClusterHQ/flocker   * https://github.com/ClusterHQ/flocker
  
-====== Volumes ====== 
-[[https://docs.docker.com/engine/tutorials/dockervolumes/]] 
- 
-  Data volumes are designed to persist data, independent of the container’s life cycle. Docker therefore never automatically delete volumes when you remove a container, nor will it “garbage collect”     volumes that are no longer referenced by a container. 
-  A Docker data volume persists after a container is deleted. 
- 
-Volumes types: 
-  * local storage (original image data located in specified directory  are copied to volume during creation) 
-  * bind-mounted host (original image data are **not copied**) 
-  * volume plugins 
- 
-===== BTRFS Volume plugin for Docker ===== 
-[[https://github.com/anybox/buttervolume]] 
- 
- 
-Volume destination inside container must be a absolute path. 
- 
-Run shell with mounted volume from another docker: 
-<code bash>docker run --rm -i --volumes-from dbdata busybox ash</code> 
-<code bash>docker run --rm -i --volumes-from dbdata debian:jessie-slim /bin/bash</code> 
- 
-Single file can be mounted as volume: 
-<code bash>docker run --rm -it -v ~/.bash_history:/root/.bash_history debian:jessie-slim bash /bin/bash</code> 
- 
-Create named volume and share it between multiple containers: 
-<code bash> 
-docker run -d -P -v my-named-volume:/opt --name test1 debian:jessie-slim bash 
-docker run -d -P -v my-named-volume:/opt --name test2 debian:jessie-slim bash 
-docker run -d -P -v my-named-volume:/opt --name test3 debian:jessie-slim bash 
-</code> 
- 
-To protect data from being deleted with volume use ''local-persist'' plugin: [[https://github.com/CWSpear/local-persist]] 
- 
-Find orphaned volumes 
-<code bash> 
-docker volume ls -f dangling=true 
-docker volume rm <volume name> 
-</code> 
- 
-Transfer volume to another host [[https://www.guidodiepen.nl/2016/05/transfer-docker-data-volume-to-another-host/]] 
- 
-[[https://github.com/gdiepen/docker-convenience-scripts/blob/master/docker_get_data_volume_info.sh]] 
- 
-====== Network ====== 
- 
-[[http://blog.oddbit.com/2014/08/11/four-ways-to-connect-a-docker/]] 
-[[http://stackoverflow.com/questions/26539727/giving-a-docker-container-a-routable-ip-address]] 
- 
-====== data persistence in swarm ====== 
-[[http://mysqlrelease.com/2016/08/trying-out-mysql-in-docker-swarm-mode/]] 
-[[https://forums.docker.com/t/data-base-persistence-in-docker-swarm-mode/20665/7]] 
  
 ====== Backup ====== ====== Backup ======
Line 188: Line 141:
  
 ====== ns ====== ====== ns ======
 +
 +
 +====== Issues ======
 +===== endpoint with name portainer already exists in network bridge =====
 +<code bash>
 +# docker start 7cda5b580e16
 +Error response from daemon: endpoint with name portainer already exists in network bridge
 +Error: failed to start containers: 7cda5b580e16
 +</code>
 +
 +https://github.com/moby/moby/issues/23302
 +
 +Typically when you see containers in docker network inspect output with a ep- prefix, that means it can be either of 2 cases -
 +    these are stale endpoints left over in the DB. For those cases, docker network disconnect should help.
 +    these are remote endpoints seen in other nodes that are part of the overlay network. The only way to clean them up are from that specific host.
 +
 +
 +Not helping:
 +<code bash>docker network prune</code>
 +<code bash>docker network disconnect -f bridge portainer</code>
 +
 +
 +
 +Helps:
 +<code bash>/etc/init.d/docker restart</code>