PageSourceSearch

https://laradock.io/assets/js/4cb0c092.3630e033.js

js laradock.io collected 2026-09-25 19:47:38 UTC 12,938 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunklaradock_documentation=globalThis.webpackChunklaradock_documentation||[]).push([[4066],{69808(e,a,r){r.r(a),r.d(a,{assets:()=>d,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>t,toc:()=>u});const t=JSON.parse('{"id":"volumes","title":"Data & Volumes","description":"Where Laradock stores your databases and files, why data survives rebuilds, and how to back up, move, or wipe a single service\'s data.","source":"@site/docs/volumes.md","sourceDirName":".","slug":"/volumes","permalink":"/docs/volumes","draft":false,"unlisted":false,"editUrl":"https://github.com/laradock/laradock/tree/master/DOCUMENTATION/docs/volumes.md","tags":[],"version":"current","frontMatter":{"slug":"/volumes","title":"Data & Volumes","description":"Where Laradock stores your databases and files, why data survives rebuilds, and how to back up, move, or wipe a single service\'s data.","keywords":["laradock data path","DATA_PATH_HOST","docker volume backup","reset mysql data docker","laradock persist data","docker bind mount"]},"sidebar":"tutorialSidebar","previous":{"title":"Manual Setup (without the CLI)","permalink":"/docs/manual-setup"},"next":{"title":"Environment & Platform","permalink":"/docs/environment"}}');var s=r(74848),n=r(28453),o=r(4865),l=r(19365);const i={slug:"/volumes",title:"Data & Volumes",description:"Where Laradock stores your databases and files, why data survives rebuilds, and how to back up, move, or wipe a single service's data.",keywords:["laradock data path","DATA_PATH_HOST","docker volume backup","reset mysql data docker","laradock persist data","docker bind mount"]},c=void 0,d={},u=[{value:"The two kinds of storage",id:"the-two-kinds-of-storage",level:2},{value:"Your data survives rebuilds",id:"your-data-survives-rebuilds",level:2},{value:"Back up a service's data",id:"back-up-a-services-data",level:2},{value:"Reset or wipe one service",id:"reset-or-wipe-one-service",level:2},{value:"Separate data per project",id:"separate-data-per-project",level:2}];function h(e){const a={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,n.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.p,{children:"Where Laradock keeps your data, why it survives rebuilds, and how to back it up or wipe it."}),"\n",(0,s.jsx)(a.h2,{id:"the-two-kinds-of-storage",children:"The two kinds of storage"}),"\n",(0,s.jsx)(a.p,{children:"Laradock mounts exactly two things from your host into the containers:"}),"\n",(0,s.jsxs)(a.ul,{children:["\n",(0,s.jsxs)(a.li,{children:[(0,s.jsx)(a.strong,{children:"Your code"}),", bind-mounted live. ",(0,s.jsx)(a.code,{children:"APP_CODE_PATH_HOST"})," (default ",(0,s.jsx)(a.code,{children:"../"}),", the folder that holds Laradock) is mounted at ",(0,s.jsx)(a.code,{children:"APP_CODE_PATH_CONTAINER"})," (",(0,s.jsx)(a.code,{children:"/var/www"}),'). Edit a file on your host and the container sees it instantly, which is why there\'s no "copy into the container" step.']}),"\n",(0,s.jsxs)(a.li,{children:[(0,s.jsx)(a.strong,{children:"Service data"})," (databases, caches, uploads), stored under ",(0,s.jsx)(a.code,{children:"DATA_PATH_HOST"})," (default ",(0,s.jsx)(a.code,{children:"~/.laradock/data"}),"). Each service gets its own sub-folder: ",(0,s.jsx)(a.a,{href:"/docs/services/mysql",children:"MySQL"})," in ",(0,s.jsx)(a.code,{children:"~/.laradock/data/mysql"}),", ",(0,s.jsx)(a.a,{href:"/docs/services/postgres",children:"PostgreSQL"})," in ",(0,s.jsx)(a.code,{children:"~/.laradock/data/postgres"}),", ",(0,s.jsx)(a.a,{href:"/docs/services/redis",children:"Redis"})," in ",(0,s.jsx)(a.code,{children:"~/.laradock/data/redis"}),", and so on."]}),"\n"]}),"\n",(0,s.jsxs)(a.p,{children:["Because both live on your ",(0,s.jsx)(a.strong,{children:"host"}),", not inside the containers, your data is safe when you stop, delete, or rebuild containers."]}),"\n",(0,s.jsx)(a.h2,{id:"your-data-survives-rebuilds",children:"Your data survives rebuilds"}),"\n",(0,s.jsx)(a.p,{children:"Stopping or deleting containers never touches your data:"}),"\n",(0,s.jsxs)(o.A,{groupId:"interface",children:[(0,s.jsx)(l.A,{value:"cli",label:"Laradock CLI",children:(0,s.jsx)(a.pre,{children:(0,s.jsx)(a.code,{className:"language-bash",children:"./laradock remove\n"})})}),(0,s.jsx)(l.A,{value:"docker",label:"Docker Compose",children:(0,s.jsx)(a.pre,{children:(0,s.jsx)(a.code,{className:"language-bash",children:"docker 
1compose down\n"})})})]}),"\n",(0,s.jsxs)(a.p,{children:["Both remove the running containers but leave everything under ",(0,s.jsx)(a.code,{children:"DATA_PATH_HOST"})," on disk. Start the services again and your databases are exactly where you left them. The only things that erase data are deleting its folder yourself (below) or a ",(0,s.jsx)(a.code,{children:"--no-cache"})," rebuild that reinitializes a volume."]}),"\n",(0,s.jsx)(a.h2,{id:"back-up-a-services-data",children:"Back up a service's data"}),"\n",(0,s.jsx)(a.p,{children:"Since data is just files on your host, a backup is a copy of the folder. Stop the service first so the files are consistent:"}),"\n",(0,s.jsx)(a.pre,{children:(0,s.jsx)(a.code,{className:"language-bash",children:"./laradock stop mysql          # or: docker compose stop mysql\ncp -r ~/.laradock/data/mysql ~/mysql-backup\n"})}),"\n",(0,s.jsx)(a.p,{children:"For databases, a logical dump is more portable across versions than copying raw files. Run it from inside the container:"}),"\n",(0,s.jsx)(a.pre,{children:(0,s.jsx)(a.code,{className:"language-bash",children:"./laradock exec mysql mysqldump -udefault -psecret mydatabase > backup.sql\n"})}),"\n",(0,s.jsx)(a.h2,{id:"reset-or-wipe-one-service",children:"Reset or wipe one service"}),"\n",(0,s.jsxs)(a.p,{children:["To start a service from a clean slate, for example to apply a new database password (credentials are only baked in on the ",(0,s.jsx)(a.strong,{children:"first"})," boot) or to clear a corrupted database, delete that service's data folder:"]}),"\n",(0,s.jsx)(a.pre,{children:(0,s.jsx)(a.code,{className:"language-bash",children:"./laradock stop mysql          # or: docker compose stop mysql\nrm -rf ~/.laradock/data/mysql\n./laradock start mysql         # or: docker compose up -d mysql\n"})}),"\n",(0,s.jsx)(a.p,{children:"The service reinitializes fresh on the next start. This affects only the service you delete; the rest are untouched."}),"\n",(0,s.jsx)(a.admonition,{type:"warning",children:(0,s.jsx)(a.p,{children:"Deleting a data folder is permanent. Back it up first if there's any chance you'll want it."})}),"\n",(0,s.jsx)(a.h2,{id:"separate-data-per-project",children:"Separate data per project"}),"\n",(0,s.jsxs)(a.p,{children:["Running more than one Laradock at once? Give each project its own ",(0,s.jsx)(a.code,{children:"DATA_PATH_HOST"})," (and ",(0,s.jsx)(a.code,{children:"COMPOSE_PROJECT_NAME"}),") in its ",(0,s.jsx)(a.code,{children:".env"})," so their databases never mix:"]}),"\n",(0,s.jsx)(a.pre,{children:(0,s.jsx)(a.code,{className:"language-env",children:"COMPOSE_PROJECT_NAME=myproject\nDATA_PATH_HOST=~/.laradock/data-myproject\n"})}),"\n",(0,s.jsxs)(a.p,{children:["See ",(0,s.jsx)(a.a,{href:"/docs/multiple-projects",children:"Running Multiple Projects"})," for the full setup."]})]})}function p(e={}){const{wrapper:a}={...(0,n.R)(),...e.components};return a?(0,s.jsx)(a,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},19365(e,a,r){r.d(a,{A:()=>i});r(96540);var t=r(34164),s=r(47751);const n="tabItem_Ymn6";var o=r(74848);function l({children:e,className:a,hidden:r}){return(0,o.jsx)("div",{role:"tabpanel",className:(0,t.A)(n,a),hidden:r,children:e})}function i({children:e,className:a,value:r}){const{selectedValue:t,lazy:n}=(0,s.uc)(),i=r===t;return!i&&n?null:(0,o.jsx)(l,{className:a,hidden:!i,children:e})}},4865(e,a,r){r.d(a,{A:()=>m});r(96540);var t=r(34164),s=r(17559),n=r(47751),o=r(23104),l=r(92303);const i="tabList__CuJ",c="tabItem_LNqP";var d=r(74848);function u({className:e}){const{selectedValue:a,selectValue:r,tabValues:s,block:l}=(0,n.uc)(),i=[],{blockElementScrollPositionUntilNextRender:u}=(0,o.a_)(),h=e=>{const t=e.currentTarget,n=i.indexOf(t),o=s[n].value;o!==a&&(u(t),r(o))},p=e=>{let a=null;switch(e.key){case"Enter":h(e);break;case"ArrowRight":{const r=i.indexOf(e.currentTarget)+1;a=i[r]??i[0];break}case"ArrowLeft":{const r=i.indexOf(e.currentTarget)-1;a=i[r]??i[i.length-1];break}}a?.focus()};return(0,d.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,t.A)("tabs",{"tabs--block":l},e),children:s.map(({value:e,label:r,attributes:s})=>(0,d.jsx)("li",{role:"tab",tabIndex:a===e?0:-1,"aria-selected":a===e,ref:e=>{i.push(e)},onKeyDown:p,onClick:h,...s,className:(0,t.A)("tabs__item",c,s?.className,{"tabs__item--active":a===e}),children:r??e},e))})}function h({children:e}){return(0,d.jsx)("div",{className:"margin-top--md",children:e})}function p({className:e,children:a}){return(0,d.jsxs)("div",{className:(0,t.A)(s.G.tabs.container,"tabs-container",i),children:[(0,d.jsx)(u,{className:e}),(0,d.jsx)(h,{children:a})]})}function m(e){const a=(0,l.A)(),r=(0,n.OC)(e);return(0,d.jsx)(n.O_,{value:r,children:(0,d.jsx)(p,{className:e.className,children:(0,n.vT)(e.children)})},String(a))}},47751(e,a,r){r.d(a,{OC:()=>m,O_:()=>b,uc:()=>f,vT:()=>d});var t=r(96540),s=r(56347),n=r(205),o=r(57485),l=r(70679),i=r(31682),c=r(74848);function d(e){return t.Children.toArray(e).filter(e=>"\n"!==e)}function u(e){const{values:a,children:r}=e;return(0,t.useMemo)(()=>{const e=a??function(e){return t.Children.toArray(e).flatMap(e=>{if(!e)return[];if((0,t.isValidElement)(e)&&function(e){const{props:a}=e;return!!a&&"object"==typeof a&&"value"in a}(e))return[e];
1const a="string"==typeof e.type?e.type:e.type.name;throw new Error(`Docusaurus error: Bad <Tabs> child <${a}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.\nIf you do not want to pass on a "value" prop to the direct children of <Tabs>, you can also pass an explicit <Tabs values={...}> prop.`)}).map(({props:{value:e,label:a,attributes:r,default:t}})=>({value:e,label:a,attributes:r,default:t}))}(r);return function(e){const a=(0,i.XI)(e,(e,a)=>e.value===a.value);if(a.length>0)throw new Error(`Docusaurus error: Duplicate values "${a.map(e=>`'${e.value}'`).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e},[a,r])}function h({value:e,tabValues:a}){return a.some(a=>a.value===e)}function p({queryString:e=!1,groupId:a}){const r=(0,s.W6)(),n=function({queryString:e=!1,groupId:a}){if("string"==typeof e)return e;if(!1===e)return null;if(!0===e&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:e,groupId:a});return[(0,o.aZ)(n),(0,t.useCallback)(e=>{if(!n)return;const a=new URLSearchParams(r.location.search);a.set(n,e),r.replace({...r.location,search:a.toString()})},[n,r])]}function m(e){const{defaultValue:a,queryString:r=!1,groupId:s}=e,o=u(e),[i,c]=(0,t.useState)(()=>function({defaultValue:e,tabValues:a}){if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(e){if(!h({value:e,tabValues:a}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${e}" but none of its children has the corresponding value. Available values are: ${a.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return e}const r=a.find(e=>e.default)??a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:a,tabValues:o})),[d,m]=p({queryString:r,groupId:s}),[v,f]=function({groupId:e}){const a=function(e){return e?`docusaurus.tab.${e}`:null}(e),[r,s]=(0,l.Dv)(a);return[r,(0,t.useCallback)(e=>{a&&s.set(e)},[a,s])]}({groupId:s}),b=(()=>{const e=d??v;return h({value:e,tabValues:o})?e:null})();(0,n.A)(()=>{b&&c(b)},[b]);return{selectedValue:i,selectValue:(0,t.useCallback)(e=>{if(!h({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);c(e),m(e),f(e)},[m,f,o]),tabValues:o,lazy:e.lazy??!1,block:e.block??!1}}const v=(0,t.createContext)(null);function f(){const e=t.useContext(v);if(!e)throw new Error("useTabsContext() must be used within a Tabs component");return e}function b(e){return(0,c.jsx)(v.Provider,{value:e.value,children:e.children})}},28453(e,a,r){r.d(a,{R:()=>o,x:()=>l});var t=r(96540);const s={},n=t.createContext(s);function o(e){const a=t.useContext(n);return t.useMemo(function(){return"function"==typeof e?e(a):{...a,...e}},[a,e])}function l(e){let a;return a=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),t.createElement(n.Provider,{value:a},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.