Oliver Hader
Oliver Hader

Reputation: 4200

How to relocate DDEV project that was moved to different directory?

Scenario

Unable to get project(s): stat /home/old-path/project-name: no such file or directory

Question

Which steps are required in order to "relocate" the directory and get DDEV up and running again?

Upvotes: 8

Views: 5409

Answers (6)

rfay
rfay

Reputation: 12975

Please ddev stop --unlist <project> to stop (and forget) the project, then ddev start in the new directory.

This is also in the FAQ.

Upvotes: 14

mikenificent
mikenificent

Reputation: 81

I had the same issue. My solution:

ddev stop --unlist <projectname>
ddev start

This worked for me.

Upvotes: 0

Rogoit
Rogoit

Reputation: 91

I had to do a "ddev stop --unlist projectname" and do a "ddev start". Can not say if i lose data because it was a sqlite.

Upvotes: 1

Robbozinoz
Robbozinoz

Reputation: 1

Also use the ddev rm --unlist once you have used ddev rm . Not sure if it is a recent addition to the CLI

Upvotes: 0

arx-e
arx-e

Reputation: 71

There is a file named global_config.yaml that resides in your user's home .ddev folder (on my windows machine it is C:\Users\username\.ddev).

Inside this file you will find the section project_info: that lists your projects and their paths. If you moved the project files you can enter the new path here.

If you moved the files to another disk you also have to go to docker Settings>Resources>File Sharing and make sure the new disk is enabled here and cab be bind mounted.

Upvotes: 3

Oliver Hader
Oliver Hader

Reputation: 4200

Analysis

Since DDEV outlined the correct old path name, it also must be stored somewhere. I've analyzed directory ~/.ddev/project-name/, but could not find any pointer to the old path name there. It seems that this information is stored at some other place.

Docker Containers

Executing docker ps -a | grep project-name shows the following:

1f4eb31fc94e        drud/ddev-webserver:v1.3.0        "/start.sh"              2 months ago        Exited (0) 2 months ago                                                                                                ddev-project-name-web
052ecb7c3e1b        drud/phpmyadmin:v1.3.0            "/run.sh phpmyadmin"     2 months ago        Exited (0) 2 months ago                                                                                                ddev-project-name-dba
b9d71147a54f        drud/ddev-dbserver:v1.3.0         "/docker-entrypoint.…"   2 months ago        Exited (0) 2 months ago                                                                                                ddev-project-name-db

And executing docker inspect ddev-project-name-web | grep '/home/old-path/project-name' shows additional information:

"/home/old-path/project-name/.ddev:/mnt/ddev_config:ro",
"/home/old-path/project-name:/var/www/html:cached"
"Source": "/home/old-path/project-name/.ddev",
"Source": "/home/old-path/project-name",
"com.ddev.approot": "/home/old-path/project-name",

Bingo! The old path name is stored inside Docker containers. And since my (valuable) sources only are mounted to this Docker container, it seems to be safe to remove this container by executing docker rm ddev-project-name-web. Starting DDEV again in the new directory using ddev start now works again...

Summary

Given that the DDEV project is named project-name...

docker rm ddev-project-name-web
cd /home/new-path/project-name
ddev start

Upvotes: 1

Related Questions