# Using DDEV Offline

> [!WARNING]
>
> **Prepare all projects and pull Docker images before going offline**
>
> All necessary Docker images must be downloaded and built prior to working offline.
>
> Run the following commands:
>
> ```
> # Download all images for all projects
> ddev utility download-images --all
>
> # Start all projects to ensure images are built
> ddev start --all
>
> # Stop all projects
> ddev poweroff
> ```

DDEV attempts to work smoothly offline, and you shouldn’t have to do anything to make it work.

However, it cannot pull needed Docker images when offline if a new Docker image is required, so you’ll want to make sure that you try a [`ddev start`](<https://ddev.github.io/ddev/en/stable/users/usage/commands/#start>) before going offline to make sure everything has been pulled.

`ddev start` builds project images every time. If that build fails and Docker Hub can’t be reached, DDEV warns and starts with the images from the last successful build, so changes to a Dockerfile made while offline take effect on the next online `ddev start`. When Docker Hub can be reached, a failed build stops `ddev start` as usual.

If you have a project running when you’re online (using DNS for name resolution) and you then go offline, do a [`ddev restart`](<https://ddev.github.io/ddev/en/stable/users/usage/commands/#restart>) to get the hostname added into `/etc/hosts` for name resolution.

You have some general options as well:

In `.ddev/config.yaml`, [`use_dns_when_possible: false`](<https://ddev.github.io/ddev/en/stable/users/configuration/config/#use_dns_when_possible>) will make DDEV never try to use DNS for resolution, instead adding hostnames to `/etc/hosts`. You can also use `ddev config --use-dns-when-possible=false` to set this configuration option.

You can also set up a local DNS server like [dnsmasq](<https://dnsmasq.org>) (Linux and macOS, `brew install dnsmasq`) or ([unbound](<https://github.com/NLnetLabs/unbound>) or many others on Windows) in your own host environment that serves the `project_tld` that you choose, and DNS resolution will work fine. You’ll likely want a wildcard A record pointing to `127.0.0.1` on most DDEV installations. If you use dnsmasq, you must configure it to allow DNS rebinding.

To understand what’s going on with name resolution and your browser and offline use, we recommend [Hostnames and Wildcards and DDEV Oh My! on ddev.com](<https://ddev.com/blog/ddev-name-resolution-wildcards/>).

> [!NOTE]
>
> **Administrative Privileges Required**
>
> If you `ddev start` when offline, DDEV will try to add `<projectname>.ddev.site` to your `/etc/hosts` file. You must have administrative privileges to edit the hosts file on any operating system.

> [!NOTE]
>
> **Oddities of using `buildx` `docker-container` driver**
>
> This is an unusual situation, mostly encountered by DDEV developers who have been pushing images, but you may not be able to work offline if your `docker buildx inspect` shows the `docker-container` driver, and you’ll need to switch to a builder that has the `docker` driver. `docker buildx ls` will show available drivers, or you can switch to one with `docker buildx create --name docker-driver --driver docker --use`. This is reported in [docker buildx issue](<https://github.com/moby/buildkit/issues/5214>).
