docker volumes

volumes

volumes 有两种形式

1 宿主机路径(HOST:CONTAINER)

volumes:

 - ~/configs:/etc/configs/:ro #host:container

2 数据卷名称(VOLUME:CONTAINER)

匿名卷即没有显示指定名字的卷,实名卷具有名字,两种卷均存储在/var/lib/docker/volumes/区域,匿名卷的目录名是一串数字,如果在创建容器是添加了-rm参数,则匿名卷会随着容器的删除而删除

volumes:
 - /var/lib/mysql  #匿名
 - db:/var/lib/mysql #VOLUME:container

Leave a Reply

Your email address will not be published. Required fields are marked *